天道酬勤,学无止境

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. 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. the invalid address presumably refers to the send_from address. so I can't see how it can think it's wrong. here is the php code:

$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:

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.

That is the meaning of the error you are getting. This is from the hMailServer Documentation.

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.

The 4th parameter of the mail() function is not plain "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.

Try this, worked for me:

ini_set("sendmail_from", "info@yourdomain.com");

here is another solution - WAMP send Mail using SMTP localhost


KEEP IN MIND, everytime, after You change php.ini,

you must restart wamp (! ! !)

p.s. in php.ini, i have used:

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.

ini_set("SMTP", "localhost");
ini_set("smtp_port", "25");
ini_set("sendmail_from", "your_user@gmail.com");

受限制的 HTML

  • 允许的HTML标签:<a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • 自动断行和分段。
  • 网页和电子邮件地址自动转换为链接。

相关推荐
  • (WAMP / XAMP)使用SMTP本地主机发送邮件((WAMP/XAMP) send Mail using SMTP localhost [closed])
    问题 关门了。 这个问题需要更加集中。 它当前不接受答案。 想要改善这个问题吗? 更新问题,使其仅通过编辑此帖子即可将重点放在一个问题上。 1年前关闭。 改善这个问题 如何从本地SMTP发送邮件(使用Wamp,Xampp等)? PHP mail()似乎无法本地运行。 有人可以给出指示吗? 回答1 如果本地xampp,wamp有问题,您可以使用此库发送电子邮件。 class.phpmailer.php,class.smtp.php在您的电子邮件函数调用的文件中编写此代码 include('class.phpmailer.php'); $mail = new PHPMailer(); $mail->IsHTML(true); $mail->IsSMTP(); $mail->SMTPAuth = true; $mail->SMTPSecure = "ssl"; $mail->Host = "smtp.gmail.com"; $mail->Port = 465; $mail->Username = "your email ID"; $mail->Password = "your email password"; $fromname = "From Name in Email"; $To = trim($email,"\r\n"); $tContent = ''; $tContent .="
  • 邮件发送退信分析大全/SMTP error, RCPT TO: 550 Relay Deny
    一般情况下,当您发送的邮件无法正常到达收件人时,mail 邮件系统将会自动给您发一封警告信,这封退信通知里面包含了无法正常发送到对方邮件地址的原因,所以绝大多数情况下可以通过退信通知来找出发信失败的原因及解决方式。当您收到退信时,可以选择将您收到的退信通知的原件完整的转发给我们,由我们协助分析退信产生的原因并提供对应的解决方式。或者您可以参照以下的方式,查看退信内容确认退信原因以便找出解决方式。下面这是一个典型的退信的内容,右边对应的是退信内容的含义。Hi. This is the smtp delivery program.I'm afraid I wasn't able to deliver your message to the followingaddresses.This is a permanent error; I've given up. Sorry it didn't work out.=====================================================  您好!  您的邮件不能成功的递送到指定地址。这是一个永久的错误,因此不得不放弃继续递送。, sorry, no mailbox here by that name  错误原因--- Below this line is a copy of the message
  • “Password not accepted from server: 535 Incorrect authentication data” when sending with GMail and phpMailer
    I have the same php script running on localhost - my PC with XAMPP and on a hosted server. It works from my PC, but not from the hosted server. When I send it from the hosted server, I get the following output: SMTP -> ERROR: Password not accepted from server: 535 Incorrect authentication data SMTP -> ERROR: RCPT not accepted from server: 550-Please turn on SMTP Authentication in your mail client, or login to the 550-IMAP/POP3 server before sending your message. dev.camppage.com 550-(patchvalues.com) [205.234.141.238]:50958 is not permitted to relay through 550 this server without
  • 如何在不发送电子邮件的情况下检查电子邮件地址是否存在?(How to check if an email address exists without sending an email?)
    问题 我碰到过此PHP代码,无需发送电子邮件即可使用SMTP检查电子邮件地址。 有没有人尝试过类似的方法或对您有用? 您能告诉客户/用户输入的电子邮件是否正确并且存在吗? 回答1 有时可以使用两种方法来确定收件人是否确实存在: 您可以连接到服务器,然后发出VRFY命令。 很少有服务器支持此命令,但正是为此目的而设计的。 如果服务器以2.0.0 DSN响应,则该用户存在。 VRFY user 您可以发出RCPT ,并查看邮件是否被拒绝。 MAIL FROM:<> RCPT TO:<user@domain> 如果该用户不存在,您将获得5.1.1 DSN。 但是,仅因为未拒绝电子邮件并不意味着该用户存在。 某些服务器会像这样静默丢弃请求,以防止枚举其用户。 其他服务器无法验证用户,并且无论如何都必须接受消息。 还有一种称为灰名单的反垃圾邮件技术,它将使服务器最初拒绝该地址,并期望真正的SMTP服务器将在一段时间后尝试重新发送。 这会弄乱验证地址的尝试。 老实说,如果您尝试验证地址,最好的方法是使用一个简单的正则表达式来阻止明显无效的地址,然后将实际的电子邮件及其链接发送回系统,以验证是否已接收到该电子邮件。 这也可以确保他们的用户输入了他们的实际电子邮件,而不是碰巧属于其他人的轻微错字。 回答2 此处的其他答案讨论了尝试执行此操作时遇到的各种问题。
  • php.ini&SMTP =-如何传递用户名和密码(php.ini & SMTP= - how do you pass username & password)
    问题 My ISP帐户要求我发送出站SMTP邮件的用户名和密码。 执行php.mail()?时,如何让PHP使用此功能php.mail()? php.ini文件仅包含服务器(SMTP= )和From: (sendmail_from= )条目。 回答1 PHP mail()命令不支持身份验证。 您的选择: PHPMailer-教程梨-教程自定义功能-请参阅注释部分中的各种解决方案:http://php.net/manual/zh/ref.mail.php 回答2 我将以下详细信息应用于php.ini文件。 它的作品很好。 SMTP = smtp.example.com smtp_port = 25 username = info@example.com password = yourmailpassord sendmail_from = info@example.com 这些详细信息与Outlook设置相同。 回答3 使用Windows的Fake sendmail发送邮件。 在C:\wamp\创建一个名为sendmail的文件夹。 将以下4个文件提取到sendmail文件夹中: sendmail.exe , libeay32.dll , ssleay32.dll和sendmail.ini 。 然后配置C:\wamp\sendmail\sendmail.ini : smtp
  • mail邮件退信常见错误
    1、邮件地址错误 如果退信原因中有如下信息之一,请检查收信人的邮件地址是否有误。 550 <[email]xxx@xxx.xxx.xx.xx[/email]>...User unknow 550 Requested action not taken:mailbox unavailable 550.5.1.1 <[email]xxx@xxx.xxx.xx.xx[/email]> is not a valid mailbox Sorry, no mailbox here by that name 550 Invalid recipient <[email]xxx@xxx.xxx.xx.xx[/email]> [email]xxx@xxx.xxx.xx.xx[/email](user not found) 如果邮件地址是正确的,那可能对方的这个电子邮件信箱已经不再使用了。为了确定,可再重发一次以防是由于对方邮箱的收件服务器的技术故障而导致的退信。 2、邮箱空间不够 如果退信原因中显示如下信息之一,表示邮箱溢出。 552 Message size exceeds fixed maximum message size(5000000) 552 Message size exceeds maximum message size 552 Message size exceeds fixed
  • 企业邮件系统搭建-关于不能往yahoo,sina,hotmail地址发邮件的问题二
    7.Notes服务器HELO域的设置方法具体位置在:服务器---基本---全限定的Internet主机名8.imail的HELO应该是localhost的gen 7.Notes服务器HELO域的设置方法具体位置在:服务器---基本---全限定的Internet主机名 8.imail的HELO应该是 localhost 的general面板上的 Host Name 如Host Name这里是HI.com 那么imail 所用的就是helo HI.com另外 Imail管理面板-》服务-》SMTP-》advance->Hello Message->HIi.com 只不过修改是smtp的banner信息 9.MDaemon Server的HELO在Setup-》Primary Domain-》HELO Domain Name中设定。10Winmail Server的设定:管理工具->系统设置->SMTP设置->基本参数->HELO/EHLO 主机名。可用nslookup命令查找,YourDomain MX preference = 10, mail exchanger =后面的内容即为正确的HELO/EHLO 主机名。如满足以上要求,发到 sina 还是被退回相同的信件,请和 sina 联系。联系方式如下:邮箱地址:antispam@staff.sina.com.cn 或
  • 如何使用PHP发送电子邮件?(How to send an email using PHP?)
    问题 我在网站上使用PHP,并且想添加电子邮件功能。 我已经安装了WAMPSERVER。 如何使用PHP发送电子邮件? 回答1 使用PHP的mail()函数是可能的。 请记住,邮件功能在本地服务器上不起作用。 <?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); ?> 参考: http://php.net/manual/zh/function.mail.php 回答2 您也可以在https://github.com/PHPMailer/PHPMailer中使用PHPMailer类。 它允许您透明地使用邮件功能或使用smtp服务器。 它还处理基于HTML的电子邮件和附件,因此您不必编写自己的实现。 该类是稳定的,它被许多其他项目(例如Drupal,SugarCRM,Yii和Joomla)使用。 这是上一页的示例: <?php require
  • 使用Java发送电子邮件(Send email using java)
    问题 我正在尝试使用Java发送电子邮件: import java.util.*; import javax.mail.*; import javax.mail.internet.*; import javax.activation.*; public class SendEmail { public static void main(String [] args) { // Recipient's email ID needs to be mentioned. String to = "abcd@gmail.com"; // Sender's email ID needs to be mentioned String from = "web@gmail.com"; // Assuming you are sending email from localhost String host = "localhost"; // Get system properties Properties properties = System.getProperties(); // Setup mail server properties.setProperty("mail.smtp.host", host); // Get the default Session object. Session
  • Zabbix监控之邮件发送失败-smtp-server: 错误代码550与535
    原始问题背景:前几天运维同事突然发现zabbix监控上面不再发送邮件了,而zabbix的监控界面状态都是能够显示出来。因为之前出现过类似的问题,估计是163邮箱的问题,于是登陆用于告警的邮箱,直接通过网页发送邮件也同样报错,估计是邮件防垃圾服务进行了限制,需要等到第二天才能恢复(第二天确实恢复正常),但是当天如果需要继续使用zabbix的邮箱监控的话,只能通过更换告警邮箱。于是配置了新的邮箱qixin_monitor@163.com用于告警。新问题如下[root@zabbix_master ~]# tail -n 5 /etc/mail.rc //查看mail.rc的邮箱配置 #setting for zabbix set from=qixin_monitor@163.com smtp=smtp.163.com set smtp-auth-user=qixin_monitor smtp-auth-password=test_haha16 set smtp-auth=login [root@zabbix_master ~]# echo “mail content”|mail -s test 17701754487@163.com [root@zabbix_master ~]# smtp-server: 550 User has no permission //550报错 "/root
  • SMTP 5.7.57 error when trying to send email via Office 365
    I'm trying to set up some code to send email via Office 365's authenticated SMTP service: var _mailServer = new SmtpClient(); _mailServer.UseDefaultCredentials = false; _mailServer.Credentials = new NetworkCredential("test.user@mydomain.com", "password"); _mailServer.Host = "smtp.office365.com"; _mailServer.TargetName = "STARTTLS/smtp.office365.com"; // same behaviour if this lien is removed _mailServer.Port = 587; _mailServer.EnableSsl = true; var eml = new MailMessage(); eml.Sender = new MailAddress("test.user@mydomain.com"); eml.From = eml.Sender; eml.to = new MailAddress("test.recipient
  • Gmail Error :The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required
    I am using following code to send email. The Code works correctly in my local Machine. But on Production server i am getting the error message var fromAddress = new MailAddress("mymailid@gmail.com"); var fromPassword = "xxxxxx"; var toAddress = new MailAddress("yourmailid@yourdoamain.com"); string subject = "subject"; string body = "body"; System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient { Host = "smtp.gmail.com", Port = 587, EnableSsl = true, DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network, UseDefaultCredentials = false, Credentials = new NetworkCredential
  • 无法在Windows 8上使用php邮件功能发送电子邮件(Can't send email with php mail function on windows 8)
    问题 我已经在Windows 8上安装了wamp。 出现错误: 警告:mail()[function.mail]:无法通过“ localhost”端口25连接到邮件服务器,无法在php.ini中验证您的“ SMTP”和“ smtp_port”设置,或在C:\ wamp \ www \中使用ini_set()第9行的mail.php 这是简单的源代码: <?php // The message $message = "Line 1\r\nLine 2\r\nLine 3"; // In case any of our lines are larger than 70 characters, we should use wordwrap() $message = wordwrap($message, 70, "\r\n"); // Send mail('caffeinated@example.com', 'My Subject', $message); ?> 我必须在Windows 8上安装哪些软件才能通过php通过电子邮件发送电子邮件? sendmail,msmtp或ssmtp? 回答1 尝试这个 配置此设置 在php.ini中 SMTP=smtp.gmail.com smtp_port=587 sendmail_from = my-gmail-id@gmail.com
  • 如何在ASP.NET C#中发送电子邮件(How to send email in ASP.NET C#)
    问题 我是ASP.NET C#领域的新手。 我打算通过ASP.NET C#发送邮件,这是我的ISP的SMTP地址: smtp-proxy.tm.net.my 以下是我尝试执行的操作,但失败了。 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="SendMail" %> <html> <head id="Head1" runat="server"><title>Email Test Page</title></head> <body> <form id="form1" runat="server"> Message to: <asp:TextBox ID="txtTo" runat="server" /><br> Message from: <asp:TextBox ID="txtFrom" runat="server" /><br> Subject: <asp:TextBox ID="txtSubject" runat="server" /><br> Message Body:<br> <asp:TextBox ID="txtBody" runat="server" Height="171px" TextMode="MultiLine" Width="270px" /
  • Amazon SES Email address is not verified
    I'm starting with the amazon servers and started studying about SES. I am using asp.net C # and made ​​my code based tutorials. I already checked the domain and also checked the emails in which I will run the test. So that when I run my code it generates the following error message: Transaction failed. The server response was: Message rejected: Email address is not verified. I do not know what it is because I followed all possible steps, single detail is not yet ordered the release of access to production. But I think it can not be, I'm still testing the service. My Code public void
  • Unable to find the socket transport “ssl” - did you forget to enable it when you configured PHP?
    I'm googling for how to this error a lot of hours. I've tried all solutions from this topic without luck. <? phpinfo(); ?> (the only difference I'm using Appserver instead of IIS) it doesn't show anything realated to SSL. What else should I try? The full error message: <b>Warning</b>: fsockopen() [<a href='function.fsockopen'>function.fsockopen</a>]: unable to connect to ssl://smtp.gmail.com:465 (Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?) in <b>C:\AppServ\www\webgitz\test\class.smtp.php</b> on line <b>122</b><br /> SMTP -> ERROR: Failed to
  • 无法通过PHPMailer使用Gmail SMTP服务器发送电子邮件,出现错误:端口587上的邮件提交需要SMTP AUTH。如何解决?(Unable to send email using Gmail SMTP server through PHPMailer, getting error: SMTP AUTH is required for message submission on port 587. How to fix?)
    问题 I would like to send an email using Gmail SMTP server through PHP Mailer. this is my code <?php require_once('class.phpmailer.php'); $mail = new PHPMailer(); $mail->IsSMTP(); $mail->CharSet="UTF-8"; $mail->SMTPSecure = 'tls'; $mail->Host = 'smtp.gmail.com'; $mail->Port = 587; $mail->Username = 'MyUsername@gmail.com'; $mail->Password = 'valid password'; $mail->SMTPAuth = true; $mail->From = 'MyUsername@gmail.com'; $mail->FromName = 'Mohammad Masoudian'; $mail->AddAddress('anotherValidGmail@gmail.com'); $mail->AddReplyTo('phoenixd110@gmail.com', 'Information'); $mail->IsHTML(true); $mail-
  • How to to send mail using gmail in Laravel?
    I try again and again to test sending an email from localhost but I still cannot. I don't know anymore how to do it. I try search to find solution but I cannot find one. I edited config/mail.php: <?php return [ /* |-------------------------------------------------------------------------- | Mail Driver |-------------------------------------------------------------------------- | | Laravel supports both SMTP and PHP's "mail" function as drivers for the | sending of e-mail. You may specify which one you're using throughout | your application here. By default, Laravel is setup for SMTP mail. | |
  • Gmail错误:SMTP服务器需要安全连接,或者客户端未通过身份验证。 服务器响应为:5.5.1需要身份验证(Gmail Error :The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required)
    问题 我正在使用以下代码发送电子邮件。 该代码在我的本地计算机上正常工作。 但是在生产服务器上,我收到错误消息 var fromAddress = new MailAddress("mymailid@gmail.com"); var fromPassword = "xxxxxx"; var toAddress = new MailAddress("yourmailid@yourdoamain.com"); string subject = "subject"; string body = "body"; System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient { Host = "smtp.gmail.com", Port = 587, EnableSsl = true, DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network, UseDefaultCredentials = false, Credentials = new NetworkCredential(fromAddress.Address, fromPassword) }; using (var message = new MailMessage(fromAddress
  • 使用GMail SMTP服务器从PHP页面发送电子邮件(Send email using the GMail SMTP server from a PHP page)
    问题 我正在尝试从PHP页面通过GMail的SMTP服务器发送电子邮件,但出现此错误: 身份验证失败[SMTP:SMTP服务器不支持身份验证(代码:250,响应:mx.google.com,为您提供服务,[98.117.99.235]大小:35651584 8位MIME STARTTLS增强的状态代码,用于伪装)] 有人可以帮忙吗? 这是我的代码: <?php require_once "Mail.php"; $from = "Sandra Sender <sender@example.com>"; $to = "Ramona Recipient <ramona@microsoft.com>"; $subject = "Hi!"; $body = "Hi,\n\nHow are you?"; $host = "smtp.gmail.com"; $port = "587"; $username = "testtest@gmail.com"; $password = "testtest"; $headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject); $smtp = Mail::factory('smtp', array ('host' => $host, 'port' => $port, 'auth'