在 XAMPP 上设置本地邮件(SMTP、POP3、IMAP)服务器
但是当我尝试发送邮件时,我收到以下错误:邮件服务器的日志文件指出以下错误:( ! ) Warning: mail() [function.mail]: SMTP server response: 550 The address is not valid. in C:\wamp\www\kariyersitem\register.php on line 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
,在我的config.php
文件中它被写作olcayertas@gmail.com
。在发送邮件之前,我使用echo函数调试了我的代码,并且是正确的。
目前我的$contact变量被设置为:
$contact = "olcayertas@gmail.com";
更新 1
按照 @Jared Farrish 的建议,在 php.ini
中将 sendmail_from
设置为 olcayertas@gmail.com
解决了第一个问题。但现在我有一个新问题:
"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."
但是我已经在设置->协议->SMTP->电子邮件传递->SMTP中继
下填写了SMTP身份验证设置。服务器需要身份验证
和使用SSL
选项已被勾选。
更新4
在设置->高级->IP范围->我的计算机
中禁用hMailServer的要求SMPTP身份验证
选项解决了SMTP身份验证问题。
mail()
函数的参数设置。 - Jonathon