我正在使用Ubuntu.I使用以下命令在我的本地主机上安装了sendmail
sudo apt-get install sendmail
现在我想使用下面的php代码检查邮件是否从我的本地主机发出。
<?php
$to = "test@test.com";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "someonelse@example.com";
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>
当我执行代码时,它花费了很长的时间,最后作为邮件发送回显消息。有没有可能解决这个问题?
发布于 2012-11-29 08:35:34
我知道这个问题已经得到了回答,但我发布这篇文章是希望能帮助其他人寻找解决这个问题的不同方法。
对我来说,我只需要将服务器的完全限定域名(FQDN)放入/etc/mailname
。例如:server.example.com
。
重新启动Sendmail以应用更改。
$ sudo service sendmail restart
发布于 2013-10-26 02:02:14
这个答案帮助了我的https://serverfault.com/a/221894/186680
Postfix和sendmail的安装位置。已删除sendmail Yum remove sendmail
发布于 2011-09-28 14:07:32
延迟通常表示DNS超时。您的机器是否配置了正确的DNS条目?我会尝试在命令行中使用mail进行测试,因为这样可以隔离问题。
https://stackoverflow.com/questions/7578952
复制相似问题