uncleronin Posted February 22, 2007 Share Posted February 22, 2007 Okay, I feel really irritated at the moment because I can't send emails! To put it simply, I have a mail 'script' that I want to use to send mail. Being the lazy bum that I am, I am using PHP's mail() function. I set the headers and the subject and all the rest of that good stuff and this is the message it displays: SMTP server response: 503 You must send RCPT TO: first in C:\Folders...\Mail.php on line... I'm not very familiar with SMTP headers though so I'm pretty sure I have a mistake in their definition. At the moment this is what I've got: $headers = 'From: AutomatedMailingScript<[email protected]>'.$eol; $headers .= 'RCPT-TO: AutomatedMailingScript<[email protected]>'.$eol; $headers .= 'Reply-To: AutomatedMailingScript<[email protected]>'.$eol; $headers .= 'Return-Path: AutomatedMailingScript<[email protected]>'.$eol; $headers .= "Message-ID: <".$now." TheSystem@".$_SERVER['SERVER_NAME'].">".$eol; $headers .= "X-Mailer: PHP v".PHPVersion().$eol; function SendMail($ToAddress, $Subject, $Message) { Mail($ToAddress, $Subject, $Message, $headers); } I've searched far and wide for a possible solution but I can't find anything. I'm connecting to a remote mail server which is running some version of linux - all of this is set up. Can anybody come up with a solution to this? Link to comment https://forums.phpfreaks.com/topic/39604-smtp-mail-error-503-rcpt-to/ Share on other sites More sharing options...
btherl Posted February 22, 2007 Share Posted February 22, 2007 RCPT TO is part of the SMTP protocol, and isn't related to headers (which occur in the DATA section of SMTP). Are you sure the $ToAddress is set properly? You might want to try sending a simple email to yourself calling Mail() directly, and see if that works. Link to comment https://forums.phpfreaks.com/topic/39604-smtp-mail-error-503-rcpt-to/#findComment-191128 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.