我到处寻找这个,我真的很想解决这个问题。在过去,我最终只使用了像 SendGrid for PHP 这样的 SMTP 服务和像 SwiftMailer 这样的邮件插件。但是我想使用 PHP。
基本上是我的设置(我是服务器设置的新手,这是我按照教程进行的个人设置)
Nginx
Rackspace Cloud
PHP 5.3 PHP-FPM
Ubuntu 11.04
我phpinfo()
返回关于邮件条目的信息:
mail.log no value
mail.add_x_header On
mail.force_extra_parameters no value
sendmail_from no value
sendmail_path /usr/sbin/sendmail -t -i
SMTP localhost
smtp_port 25
有人可以帮我解释为什么Mail()
不起作用-我的脚本在所有其他站点上都可以使用,这是一个普通的邮件命令。我需要在服务器上设置日志或启用一些 PHP 端口吗?
我的示例脚本
<?
# FORMS VARS
// $to = $customers_email;
// $to = $customers_email;
$to = $_GET["customerEmailFromForm"];
$subject = "Thank you for contacting Real-Domain.com";
$message = "
<html>
<head>
</head>
<body>
Thanks, your message was sent and our team will be in touch shortly.
<img src='http://cdn.com/emails/thank_you.jpg' />
</body>
</html>
";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= 'From: <real-email@real-domain.com>' . "\r\n";
// SEND MAIL
mail($to,$subject,$message,$headers);
?>
谢谢