【发布时间】:2012-04-24 10:06:15
【问题描述】:
这是我的配置文件。
发送邮件.ini
[sendmail]
; you must change mail.mydomain.com to your smtp server,
; or to IIS's "pickup" directory. (generally C:\Inetpub\mailroot\Pickup)
; emails delivered via IIS's pickup directory cause sendmail to
; run quicker, but you won't get error messages back to the calling
; application.
smtp_server=(Correct SMTP Server)
; smtp port (normally 25)
smtp_port=25
php.ini
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = (Correct SMTP Server)
; http://php.net/smtp-port
smtp_port = 25
; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = (user@(server.com)) <- correct name
PHP 代码
<?php
$from_name = "testing";
$from_email = "myemail@something.com";
$headers = "From: $from_name <$from_email>";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
$body = "Hi,\nThis is a test mail from $from_name <$from_email>.";
$subject = "Test mail from test";
$to = "myemail@something.com";
if (mail($to, $subject, $body, $headers)) {
echo "success!";
} else {
echo "fail…";
}
?>
当我运行代码时,它确实说电子邮件已发送,但是当我检查电子邮件时,没有任何东西可以接收...请帮助!谢谢,我会提供尽可能多的相关信息来解决这个问题。
【问题讨论】:
-
您是否将其发送到大型域(例如 gmail、aol、yahoo)?如果是这样发送邮件而不采取某些步骤(正确的 DNS,您的 IP 的非通用主机名)将增加您的垃圾邮件分数。另外,如果需要,您是否使用 SMTP 服务器进行身份验证?
-
您是否设置了 MX 记录?
-
@drew 我将其发送到公司的 Microsoft Outlook 电子邮件。我没有通过 SMTP 服务器进行身份验证,因为它不需要任何身份验证用户和密码。
-
@blake 请原谅我缺乏知识先生,但是 MX 记录设置是什么?
标签: php email outlook xampp localhost