尽管将php.ini配置为有效的send_from地址,但我收到此错误.我知道它是有效的,因为当我从松鼠邮件发送它时它起作用但是当用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
解决方法:
550 Delivery is not allowed to this address
This error means that the sender is trying to send an email to an
address which he is not allowed to send to. This message is generated
after hMailServer has checked the IP range settings. As an example,
the default IP range configuration does not allow external users to
send messages to other external users. This is to prevent people from
using your server to send spam. So if an external user tries to send a
message to another external user, he will get this message.
你可以尝试以下方法吗?
mail('tobiasvogel1@googlemail.com','Test Email','This is a test email.',"From: tobiasvogel1@googlemail.com");
?>
如果它不起作用,那么可能是由于你的hMailServer配置错误而你需要检查你的hMailServer Logs.
标签:php,smtp,hmail-server
来源: https://codeday.me/bug/20190923/1814525.html