尽管将 php.ini 配置为有效的 send_from 地址,但我收到此错误。我知道它是有效的,因为当我从 squirrel 邮件发送它时它可以工作,但是当用 php 发送邮件时它就不起作用了。无效地址大概是指 send_from 地址。所以我看不出它怎么会认为这是错误的。这是php代码:
$email="tobiasvogel1@googlemail.com";
$subject = "Your New Password";
$from="admin@dayshare.local";
$message = "Your new password is as follows:
xxxxxxxxxxxxxxxxxxxxxxxxxxx
This email was automatically generated.";
if(!mail($email, $subject,$message,$from)){
echo ("error");
}else echo "success";
在 php.ini 中:
SMTP = localhost
sendmail_from = admin@dayshare.local