[英]mail(): SMTP server response: 550 The address is not valid error on hmailserver
I am getting this error despite configuring php.ini to a valid send_from address. 尽管将php.ini配置为有效的send_from地址,但仍收到此错误。 I know it is valid because it works when I send it from squirrel mail but when sending mail in php it will just not work.
我知道它是有效的,因为当我从松鼠邮件发送邮件时它可以工作,但是在php中发送邮件时它就行不通了。 the invalid address presumably refers to the send_from address.
无效地址大概是指send_from地址。 so I can't see how it can think it's wrong.
所以我看不出它怎么会认为这是错误的。 here is the php code:
这是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";
and in php.ini: 并在php.ini中:
SMTP = localhost
sendmail_from = admin@dayshare.local
550 Delivery is not allowed to this address
550不允许送货到该地址
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.
hMailServer检查IP范围设置后,将生成此消息。 As an example, the default IP range configuration does not allow external users to send messages to other external users.
例如,默认的IP范围配置不允许外部用户向其他外部用户发送消息。 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.
因此,如果外部用户尝试向其他外部用户发送消息,他将收到此消息。
That is the meaning of the error you are getting. 这就是您得到的错误的含义。 This is from the hMailServer Documentation .
这来自hMailServer文档 。
Can you try if the following will work? 您是否可以尝试以下方法?
<?php
mail('tobiasvogel1@googlemail.com','Test Email','This is a test email.',"From: tobiasvogel1@googlemail.com");
?>
If it doesn't work, then it's probably due to a misconfiguration in your hMailServer and you would need to check your hMailServer Logs . 如果它不起作用,则可能是由于hMailServer中的配置错误,您需要检查hMailServer日志 。
The 4th parameter of the mail() function is not plain "from". mail()函数的第4个参数不是简单的“ from”。 In your code, you are only passing the email address without "From: " - The fourth parameter is for additional mail headers, so you have to format it like this:
在您的代码中,您仅传递不带“发件人:”的电子邮件地址-第四个参数用于附加邮件头,因此您必须像这样设置其格式:
mail($email, $subject,$message,"From: admin@dayshare.local\r\nX-Mailer: PHP");
I added another header as an example. 我添加了另一个标头作为示例。
试试这个,为我工作:
ini_set("sendmail_from", "info@yourdomain.com");
您需要引号和分号:
$email="tobiasvogel1@googlemail.com";
KEEP IN MIND, everytime, after You change php.ini, 记住,每次更改php.ini之后,
ps in php.ini, i have used: php.ini中的ps,我用过:
SMTP = localhost
smtp_port = 25
sendmail_from = your_user@gmail.com
or if oyu cant edit php.ini, try to insert these lines in your php script. 或者如果oyu无法编辑php.ini,请尝试在您的php脚本中插入这些行。
ini_set("SMTP", "localhost");
ini_set("smtp_port", "25");
ini_set("sendmail_from", "your_user@gmail.com");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.