我正在尝试将邮件发送到我的本地邮件服务器。我在用hMail服务器作为邮件服务器,我已将其配置为此处提到的:
在 XAMPP 上设置本地邮件(SMTP、POP3、IMAP)服务器 http://thephpcode.blogspot.com/2009/03/setting-up-local-mail-smtp-pop3-imap.html
但是当我尝试发送邮件时出现此错误:
( ! ) 警告: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
它写成[email protected] /cdn-cgi/l/email-protection
in my config.php
文件。在发送邮件之前,我使用 echo 函数来调试我的代码,它是正确的。
目前我的 $contact 变量设置为:
$contact = "[email protected] /cdn-cgi/l/email-protection";
UPDATE 1
Setting sendmail_from
to [email protected] /cdn-cgi/l/email-protection
in 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:<[email protected] /cdn-cgi/l/email-protection>"
"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
.
UPDATE 2
我已经解决了第二个问题。这是我的错误。
UPDATE 3
现在我收到此错误:
"SENT: 530 SMTP authentication is required."
但我已经在下面填写了 SMTP 身份验证设置Settings->Ptotocols->SMTP->Delivery of e-mail->SMTP Relayer
. Server requires authentication
and Use SSL
选项已选中。
UPDATE 4
禁用Require SMPTP authentication
hMailServer 的选项Settings->Advanced->IP Ranges->My Compter
解决了SMTP认证问题。