我正在尝试将邮件发送到我的本地邮件服务器。我正在使用 hMailServer 作为邮件服务器,并且按照此处所述进行了配置:
Setting up local Mail (SMTP, POP3, IMAP) Server on XAMPP
但是当我尝试发送邮件时,出现了这个错误:
( ! ) 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."
但是我已经在Settings->Ptotocols->SMTP->Delivery of e-mail->SMTP Relayer
下填写了SMTP认证设置。 Server requires authentication
和 Use SSL
选项已选中。
更新 4
在 Settings->Advanced->IP Ranges->My Compter
中禁用 hMailServer 的 Require SMPTP authentication
选项解决了 SMTP 身份验证问题。
最佳答案
要解决 SENT: 550550 The address is not valid.
问题,您必须在 php.ini
中将 sendmail_from
设置为有效的邮件地址> 文件。
要解决SENT: 530 SMTP authentication is required
问题,打开hMailServer Administrator。转到设置->高级->IP 范围->我的电脑。禁用“需要 SMTP 身份验证”部分下的所有选项。
关于php - 发送邮件到本地邮件服务器 - "SENT: 550 The address is not valid.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8779165/