将邮件发送到本地邮件服务器 - “SENT:550地址无效。”

时间:2012-01-08 16:29:51

标签: php email local mail-server

我正在尝试将邮件发送到我的本地邮件服务器。我使用 hMailServer 作为邮件服务器,我已按照此处的说明对其进行了配置:

Setting up local Mail (SMTP, POP3, IMAP) Server on XAMPP

但是当我尝试发送邮件时,我收到了这个错误:

  

(!)警告:mail()[function.mail]:SMTP服务器响应:550   地址无效。在C:\ wamp \ www \ kariyersitem \ register.php上   161

邮件服务器的日志文件指示此错误如下:

"DEBUG" 3108    "2012-01-08 18:04:24.447"   "Creating session 14"  
"SMTPD" 3108    14  "2012-01-08 18:04:24.448"   "127.0.0.1" "SENT: 220 localhost ESMTP"  
"SMTPD" 1728    14  "2012-01-08 18:04:24.454"   "127.0.0.1" "RECEIVED: HELO olcay-pc"  
"SMTPD" 1728    14  "2012-01-08 18:04:24.455"   "127.0.0.1" "SENT: 250 Hello."  
"SMTPD" 3108    14  "2012-01-08 18:04:24.457"   "127.0.0.1" "RECEIVED: MAIL FROM:<you@yourdomain>"  
"SMTPD" 3108    14  "2012-01-08 18:04:24.458"   "127.0.0.1" "SENT: 550 The address is not valid."  
"SMTPD" 2040    14  "2012-01-08 18:04:24.459"   "127.0.0.1" "RECEIVED: QUIT"  
"SMTPD" 2040    14  "2012-01-08 18:04:24.460"   "127.0.0.1" "SENT: 221 goodbye"  
"DEBUG" 3392    "2012-01-08 18:04:24.461"   "Closing TCP/IP socket"  
"DEBUG" 3392    "2012-01-08 18:04:24.462"   "Ending session 14"  

我检查了地址,我确信它是正确的。
谁能告诉我这是什么问题?

这是我的邮件代码:

$to      = $frm_kadi;  
$subject = $site_title.' Üyelik Aktivasyonu';  
$message = 'hello';  
$headers = 'From: '.$contact."\r\n".'Reply-To: '.$contact."\r\n".'X-Mailer: PHP/'.phpversion();  
$mresult = mail($to, $subject, $message, $headers);  

我已检查$contact,并在olcayertas@gmail.com文件中将其写为config.php。在发送邮件之前,我使用echo函数来调试我的代码,这是正确的。

目前我的$ contact变量设置为:

$contact = "olcayertas@gmail.com";

更新1

sendmail_from中将olcayertas@gmail.com设置为php.ini,因为@Jared Farrish建议解决了第一个问题。但现在我遇到了一个新问题:

"DEBUG" 3108    "2012-01-08 22:15:28.497"   "Creating session 24"  
"SMTPD" 3108    24  "2012-01-08 22:15:28.498"   "127.0.0.1" "SENT: 220 localhost ESMTP"  
"SMTPD" 3108    24  "2012-01-08 22:15:28.499"   "127.0.0.1" "RECEIVED: HELO olcay-pc"  
"SMTPD" 3108    24  "2012-01-08 22:15:28.500"   "127.0.0.1" "SENT: 250 Hello."  
"SMTPD" 4380    24  "2012-01-08 22:15:28.511"   "127.0.0.1" "RECEIVED: MAIL FROM:<olcayertas@gmail.com>"  
"DEBUG" 4380    "2012-01-08 22:15:28.542"   "Total spam score: 0"  
"SMTPD" 4380    24  "2012-01-08 22:15:28.547"   "127.0.0.1" "SENT: 250 OK"  
"SMTPD" 3108    24  "2012-01-08 22:15:28.548"   "127.0.0.1" "RECEIVED: RCPT TO:<olcayertas>"  
"SMTPD" 3108    24  "2012-01-08 22:15:28.548"   "127.0.0.1" "SENT: 550 A valid address is required."  
"SMTPD" 2040    24  "2012-01-08 22:15:28.552"   "127.0.0.1" "RECEIVED: QUIT"  
"DEBUG" 2040    "2012-01-08 22:15:28.552"   "Deleting message file"  
"SMTPD" 2040    24  "2012-01-08 22:15:28.552"   "127.0.0.1" "SENT: 221 goodbye"  
"DEBUG" 4380    "2012-01-08 22:15:28.555"   "Closing TCP/IP socket"  
"DEBUG" 4380    "2012-01-08 22:15:28.556"   "Ending session 24"  

好像它没有完全获得目标地址。我正在尝试向自己发送邮件,但它只获取用户名olcayertas和遗失的域@gmail.com

更新2

我已经解决了第二个问题。这是我的错。

更新3

现在我收到了这个错误:

"SENT: 530 SMTP authentication is required."

但我已在Settings->Ptotocols->SMTP->Delivery of e-mail->SMTP Relayer下填写了SMTP身份验证设置。已检查Server requires authenticationUse SSL个。

更新4

Require SMPTP authentication中禁用hMailServer的Settings->Advanced->IP Ranges->My Compter选项解决了SMTP身份验证问题。

5 个答案:

答案 0 :(得分:12)

要解决SENT: 550550 The address is not valid.问题,您必须将sendmail_from设置为php.ini文件中的有效邮件地址。

要解决SENT: 530 SMTP authentication is required问题,请打开hMailServer Administrator。转到设置 - &gt;高级 - &gt; IP范围 - &gt;我的计算器。禁用&#34;要求SMTP身份验证&#34;下的所有选项;部分。

答案 1 :(得分:3)

您似乎正在发送“sender”-email(From-Header),如下所示:you@yourdomainyourdomain是无效的域名。将其更改为有效的电子邮件地址。

答案 2 :(得分:1)

您使用you@yourdomain作为发件人地址,服务器拒绝它 改为使用真实地址。

答案 3 :(得分:0)

我猜$contact<olcayertas@gmail.com>,这就是造成问题的原因。尝试将其更改为olcayertas@gmail.com

答案 4 :(得分:0)

每次更改php.ini后,保持心情,

你应该重启wamp(!!!)

阅读更新的php.ini

P.S。在mail();

之前,您可能需要在php脚本中使用ini_set("sendmail_from", "your_user@gmail.com");