Jump to content

SMTP mail error - 503 RCPT TO


uncleronin

Recommended Posts

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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.