用php邮件发送的邮件没有显示出来(Mail sent with php mail not showing up)

编程入门 行业动态 更新时间:2024-10-23 18:24:58
用php邮件发送的邮件没有显示出来(Mail sent with php mail not showing up)

由于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 successful

However, 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 = 25

There 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.save

on Ubuntu, copying iptables.save over and

iptables-restore <iptables.save

I 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 postfix

and that fixed the problem.

更多推荐

本文发布于:2023-08-05 07:28:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1428945.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:邮件发送   邮件   php   showing   mail

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!