由于Ubuntu遇到了一些问题,我最近将我的操作系统从Ubuntu 11.10改为Debian 7.0.0。 我已经使用Apache 2设置了LAMP。大多数事情似乎都在起作用,但是在Ubuntu上工作正常的邮件现在无法正常工作。 我使用以下代码。
$mailDelivery=mail($to,$subject,$message,$headers); if ($mailDelivery) { ?> <script type="text/javascript"> alert("Mail delivery successful"); </script> <?php } else { ?> <script type="text/javascript"> alert("Mail delivery failed"); </script> <?php }我检查了mail()的输入参数,它们与在Ubuntu上成功运行的参数相同。 此外,警报框返回
Mail delivery successful但是,邮件不会显示在地址(这是我的在线地址之一)。
我看了php.ini,它有以下几行
[mail function] ; For Win32 only. ; http://php.net/smtp SMTP = localhost ; http://php.net/smtp-port smtp_port = 25/var/log/apache2/error.log中没有关于邮件传递的信息。
我还检查了目的地电子邮件地址的垃圾邮件文件夹,那里什么都没有。
我还将iptables从Ubuntu转移到了Debian
iptables-save >iptables.save在Ubuntu上,复制iptables.save和
iptables-restore <iptables.save我还通过以下结果进行了以下调用。
peter@app-server:/var/www$ sudo cat /var/log/mail.err peter@app-server:/var/www$ sudo cat /var/log/mail.log peter@app-server:/var/www$ sudo cat /var/log/mail.warn peter@app-server:/var/www$ sudo cat /var/log/mail.info peter@app-server:/var/www$I have recently changed my OS from Ubuntu 11.10 to Debian 7.0.0 due to some problems I was having with Ubuntu. I have set up LAMP using Apache 2. Most things appear to be working about the same but mail, which was working fine on Ubuntu, is now not working properly. I use the following code.
$mailDelivery=mail($to,$subject,$message,$headers); if ($mailDelivery) { ?> <script type="text/javascript"> alert("Mail delivery successful"); </script> <?php } else { ?> <script type="text/javascript"> alert("Mail delivery failed"); </script> <?php }I checked the input arguments to mail() and they are the same as the ones that worked successfully on Ubuntu. Also, the alert box returns
Mail delivery successfulHowever, the mail does not show up at the address (which is one of my on-line addresses).
I looked at php.ini and it has the following lines
[mail function] ; For Win32 only. ; http://php.net/smtp SMTP = localhost ; http://php.net/smtp-port smtp_port = 25There is nothing about mail delivery in /var/log/apache2/error.log.
I also checked my spam folder at the destination email address and there was nothing there.
I also transferred the iptables from Ubuntu to Debian by doing
iptables-save >iptables.saveon Ubuntu, copying iptables.save over and
iptables-restore <iptables.saveI also did the following calls with the following results.
peter@app-server:/var/www$ sudo cat /var/log/mail.err peter@app-server:/var/www$ sudo cat /var/log/mail.log peter@app-server:/var/www$ sudo cat /var/log/mail.warn peter@app-server:/var/www$ sudo cat /var/log/mail.info peter@app-server:/var/www$最满意答案
好。 我找到了问题的根源。 我没有安装SMTP服务器。 我跑了
sudo apt-get install postfix并解决了这个问题。
OK. I found the source of my problem. I had not installed the SMTP server. I ran
sudo apt-get install postfixand that fixed the problem.
更多推荐
发布评论