简体   繁体   中英

cannot send mail using php mail function

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

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.

Replace @example.com with real email addresses.

and in PHP.ini set

SMTP = localhost

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM