与 GoDaddy 的 PHP 邮件问题


php mail issue with godaddy

好的...我对PHP邮件功能了解不多,所以不要为此抨击我。问题是这个...我正在使用 freedns.afraid.org 名称服务器托管我自己的网站,当您转到我的域时,它会重定向到我的no-IP域。我正在托管使用xampp。我在 godaddy 下注册了我的域名,还有我的电子邮件。以下是我如何设置从配置到代码的所有内容。由于我不知道的原因,我无法发送电子邮件!我可能把整个事情搞砸了,但我只是在寻求帮助。

PHP.ini

[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = relay-hosting.secureserver.net
; http://php.net/smtp-port
smtp_port = 3535
; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = account@godaddydomain.com
; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
sendmail_path = "'"C:'xampp'sendmail'sendmail.exe'" -t"

我的发送邮件配置

[sendmail]
smtp_server=relay-hosting.secureserver.net
smtp_port=3535
error_logfile=error.log
debug_logfile=debug.log
auth_username=
auth_password=
force_sender=

我的 HTML 和 PHP 测试电子邮件代码

<html>
<head><title>PHP Mail() test</title></head>
<body>
This form will attempt to send a test email. Please enter where this test should be sent to<br><p>
<form action = "mail.php" method = "post" name="sendmail">
Enter an email address: <input type = "text" name = "to"><br>
<input type="submit" value="Send" name="submit"><input type="reset" value="Reset" name="reset"><br><p>
<?php
if(isset($_POST['to'])) {
       $mail_to=$_POST['to'];
    $mail_subject="Test email from";
    $mail_body="This is a test email, sent from ";
    $header = "<admin@godaddydomain.com>";
    if(mail($mail_to, $mail_subject, $mail_body,$header,"-fadmin@godaddyadmin.com")) {
        print "Email sent successfully!";
    } else {
        print "Email did not send!!!!!";
    }
}
?>
</body>
</html>

调试信息

12/03/08 11:08:42 ** This is a test email, sent from 
12/03/08 11:08:42 ** --- MESSAGE END ---
12/03/08 11:08:42 ** Connecting to relay-hosting.secureserver.net:3535
12/03/08 11:08:52 ** Disconnected.
12/03/08 11:08:52 ** Disconnected.
12/03/08 11:08:52 ** Disconnected.
12/03/08 11:08:52 ** Disconnected.
12/03/08 11:08:52 ** Connect timed out.
12/03/08 11:29:18 ** --- MESSAGE BEGIN ---
12/03/08 11:29:18 ** To: bice64g@aim.com

我也收到此错误

警告:mail(( [function.mail]:无法连接到邮件服务器 "relay-hosting.secureserver.net"端口 3535,验证您的"SMTP"和 php中的"smtp_port"设置.ini或使用ini_set(( C:''xampp''htdocs''Test''mail.php 在第 20 行

12/03/08 11:29:18 ** Subject: Test email from
12/03/08 11:29:18 ** Content-type: text/html
12/03/08 11:29:18 ** From: "PHP mail() Test Script"<noreply@>
12/03/08 11:29:18 ** 
12/03/08 11:29:18 ** This is a test email, sent from 
12/03/08 11:29:19 ** --- MESSAGE END ---
12/03/08 11:29:19 ** Connecting to relay-hosting.secureserver.net:3535
12/03/08 11:29:29 ** Disconnected.
12/03/08 11:29:29 ** Disconnected.
12/03/08 11:29:29 ** Disconnected.
12/03/08 11:29:29 ** Disconnected.
12/03/08 11:29:29 ** Connect timed out.

您提供的错误表明您正在尝试使用"relay-hosting.secureserver.net"作为应用程序中的中继服务器。该地址是离开Go Daddy虚拟主机服务器的电子邮件的网关。它将无法从 Go Daddy 专用服务器或不在 Go Daddy 数据中心内的个人服务器使用。如果您在 Go Daddy 虚拟或专用服务器上托管此服务器,您可以从 Go Daddy 支持聊天中获取您的个人中继服务器信息。如果您在Go Daddy网络之外托管此应用程序,则需要从托管或网络提供商处获取正确的中继信息。希望这有帮助。

你应该注释掉sendmail_path...这是来自帮助 http://uk.php.net/manual/en/mail.configuration.php#ini.sendmail-path

该指令也适用于Windows。如果设置,则 smtp、smtp_port 和 sendmail_from将被忽略并执行指定的命令。

还要检查debug.log - 那里应该有一些指针......

您的标题

$header = "<admin@godaddydomain.com>";

无效,请尝试类似以下内容:

$headers = 'From: webmaster@example.com' . "'r'n" .
'Reply-To: webmaster@example.com';