问题
Im trying to use PHP mail on my local computer, but its just not working. I am using the standard script from the php website:
PHP error I'm getting
SMTP server response: 550 Error sending message: Error: FROM address is invalid
actual PHP
$to = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
'Reply-To: webmaster@example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
i downloaded a local mail server, argosoft. it says the service URL is http://services.argosoft.com/RelayService/Service.asmx . I assume this is what i put in php.ini.
php ini.
For Win32 only.
SMTP = services.argosoft.com/RelayService/Service.asmx
smtp_port = 25
回答1:
I have had this error before, and I believe all you have to do is change the email webmaster@example.com
to a real email. Make sure you send it to a real email as well.
回答2:
Replace @example.com with real email addresses.
and in PHP.ini set
SMTP = localhost
回答3:
Apparently, a number of mail systems have trouble with the carriage return \r
. You might want to modify your $header
to use only the new line character \n
. See if that works.
Also, you might want to try using the full From header:
From: Some Name Here <real_email@notAnExample.com>
来源:https://stackoverflow.com/questions/6210156/cannot-send-mail-using-php-mail-function