[英]cannot send mail using php mail function
我试图在我的本地计算机上使用 PHP 邮件,但它只是不起作用。 我正在使用来自 php 网站的标准脚本:
PHP 错误我得到
SMTP server response: 550 Error sending message: Error: FROM address is invalid
实际 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);
我下载了一个本地邮件服务器,argosoft。 它说服务 URL 是http://services.argosoft.com/RelayService/Service.asmx 。 我假设这就是我在 php.ini 中放入的内容。
php ini。
For Win32 only.
SMTP = services.argosoft.com/RelayService/Service.asmx
smtp_port = 25
我以前遇到过这个错误,我相信您所要做的就是将 email webmaster@example.com
更改为真正的 email。 确保您也将其发送到真正的 email。
将 @example.com 替换为真实的 email 地址。
并在 PHP.ini 设置
SMTP = localhost
显然,许多邮件系统在回车\r
方面存在问题。 您可能希望修改$header
以仅使用换行符\n
。 看看这是否有效。
此外,您可能想尝试使用完整的 From header:
From: Some Name Here <real_email@notAnExample.com>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.