Page 1 of 1

SMTP Problem (Windows)

Posted: Tue Oct 11, 2005 2:47 pm
by stebut05
feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]


Hi, 

I keep geeting an error message when trying to send an email using PHP on a Windows server and cant find the problem. I would really appreicate any help given. I get the follwong error message: 

Warning: mail() [function.mail]: SMTP server response: 501 Bad address syntax in E:\SSLRoot\premier\includes\order_update_email.php on line 57. 

My email script is as follows:

Code: Select all

<?php 
$email = $rows['customer_email_address']; 

//5)email confirmations to us and to the customer 
/* recipients */ 
$to = "<" . $email .">"; 

/* subject */ 
$subject = "Order Status Update"; 

/* message */ 
/* top of message */ 
$message = " 
<html> 
<head> 
<title>Order Status Update Confirmation</title> 
</head> 
<body> 
<p>Dear $customer_title $customer_firstname $customer_lastname,</p> 
<p>Your order status has been updated and is due to be dispatched on $dispatch_date and is due for delivery on $delivery_date. If you have any queries, 
please contact our customer services department.</p> 


<table width=\"50%\" border=\"0\"> 
<tr> 
<td> 
<p>Order Number:"; 
$message .= " &nbsp;"; 
$message .= $order_id; 
$message .= "<br>"; 
$message .= "Customer Number:"; 
$message .= " &nbsp;"; 
$message .= $customer_id; 
$message .= "<br>"; 
$message .= "Order status:"; 
$message .= " &nbsp;"; 
$message .= $customer_message; 
$message .= " &nbsp;"; 
$message .= "<p>"; 
$message .= " 

</td> 
</tr> 
</table> 
</body> 
</html>"; 

/* headers */ 
$headers = "MIME-Version: 1.0\r\n"; 
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; 
$headers .= "From: <ecommerce@christmastreeland.co.uk>\r\n"; 
$headers .= "Cc: <dianne@rainford.com>\r\n"; 
$headers .= "X-Mailer: PHP / ".phpversion()."\r\n"; 

/* mail it */ 
mail($to, $subject, $message, $headers); 


?>
Thanks in advance for any help, suggestion and advice.

Kind Regards,

Steven


feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]

Posted: Tue Oct 11, 2005 2:51 pm
by bokehman
So how are you sending the username and password to the mailserver? Or doesn't it need them?

Posted: Tue Oct 11, 2005 3:02 pm
by stebut05
Hi bokehman,

Thanks for your help.
bokehman wrote:So how are you sending the username and password to the mailserver? Or doesn't it need them?
I was running this script form test server at first and was working fine, then i switched to live server and getting problems. If i have to log in with username and password, how do i add this to script? I thought that i did not need username and password with php mailer function? I appreciate you r thoughts and comments.

regards,

Steven

Posted: Tue Oct 11, 2005 3:56 pm
by feyd
your email server likely doesn't like the <> around the to..

Posted: Tue Oct 11, 2005 4:03 pm
by stebut05
Hi feyd,
feyd wrote:your email server likely doesn't like the <> around the to..
How do i resolve this problem? thanks for your help

Regards,

Steven

Posted: Tue Oct 11, 2005 4:07 pm
by feyd
stebut05 wrote:Hi feyd,
feyd wrote:your email server likely doesn't like the <> around the to..
How do i resolve this problem? thanks for your help
remove the <> around the to... :?

Posted: Tue Oct 11, 2005 4:19 pm
by stebut05
Hi,


[/quote]remove the <> around the to... :?[/quote]

I removed <> from code and changed to:

$to = "" . $email ."";

and got the following message

Warning: mail() [function.mail]: SMTP server response: 554 : Recipient address rejected: Relay access denied in

Then changed code to:

$to = ". $email . ";

and got follwing message:

Warning: mail() [function.mail]: SMTP server response: 554 <.steven@sbwebhosting.co.uk.>: Recipient address rejected: Relay access denied in

Then changed code to:

$to = " $email ";

and got the follwing message:

Warning: mail() [function.mail]: SMTP server response: 554 : Recipient address rejected: Relay access denied in

Then changed code to:

$to = $email;

and got the following message:

Warning: mail() [function.mail]: SMTP server response: 554 : Recipient address rejected: Relay access denied in

Any thoughts?? really appricate your help


Regards,

Steven

Posted: Tue Oct 11, 2005 4:26 pm
by feyd
"Relay access denied" means the server you are trying to communicate to or through denied the sending of the email. Your server is not a registered SMTP server with it likely or something like that.. A lot of servers will not accept relay smtp messages due to the spam nature involved with them normally.. so I will again say for the fifth or so time today, use phpMailer