加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

如何让PHP mail()工作?需要帮助配置MTA

发布时间:2020-12-13 13:20:37 所属栏目:PHP教程 来源:网络整理
导读:更新:我解决了.记录以下所有内容. 我尝试了很多东西,但它不会起作用. 我不介意使用,postfix,exim4或sendmail.我只需要一步一步的指导和解释我在做什么.我也在使用Google Apps收发电子邮件. 编辑: mail.log Nov 3 01:14:02 mugbear postfix[16615]: error:
更新:我解决了.记录以下所有内容.

我尝试了很多东西,但它不会起作用.

我不介意使用,postfix,exim4或sendmail.我只需要一步一步的指导和解释我在做什么.我也在使用Google Apps收发电子邮件.

编辑:

mail.log

Nov  3 01:14:02 mugbear postfix[16615]: error: to submit mail,use the Postfix sendmail command
Nov  3 01:14:02 mugbear postfix[16615]: fatal: the postfix command is reserved for the superuser

这是什么意思?

更新编辑:通过使用sendmail_path = /usr/sbin / sendmail -t -i更正php.ini中的sendmail_path来修复

EDIT2:
PHP – 刚刚从文档中获取.仅供我,我删除了我的电子邮件.

<?php
// The message
$message = "Line 1nLine 2nLine 3";

// In case any of our lines are larger than 70 characters,we should use wordwrap()
$message = wordwrap($message,70);

// Send
mail('removed@gmail.com','My Subject',$message);

?>

EDIT3:
另一个错误:

Nov  3 07:22:29 mugbear postfix/postdrop[17131]: warning: unable to look up public/pickup: No such file or directory
Nov  3 07:22:29 mugbear postfix/postdrop[17133]: warning: unable to look up public/pickup: No such file or directory

更新到edit3:使用以下链接修复此问题:http://ubuntuforums.org/showthread.php?t=666018
运行这个:

sudo mkfifo /var/spool/postfix/public/pickup
sudo /etc/init.d/postfix restart

之后,您将收到此错误:

postfix/master[13902]: fatal: bind 0.0.0.0 port 25: Address already in use

然后,您将必须检查您的进程并终止sendmail进程,例如:

root@server:/etc/postfix# ps aux | grep mail
root     23554  0.0  0.0   8232  1900 ?        Ss   10:17   0:00 sendmail: MTA: accepting connections          
root     27308  0.0  0.0   3004   764 pts/0    S+   10:30   0:00 grep mail
root@server:/etc/postfix# kill 23554

Edit4:
这是什么意思?

Nov  3 07:34:51 mugbear postfix/pickup[17309]: 6602F1C151: uid=33 from=<www-data>
Nov  3 07:34:51 mugbear postfix/cleanup[17311]: 6602F1C151: message-id=<20101103073451.6602F1C151@mugbear.xen.prgmr.com>
Nov  3 07:34:51 mugbear postfix/qmgr[17310]: 6602F1C151: from=<www-data@mugbear.com>,size=397,nrcpt=1 (queue active)
Nov  3 07:34:51 mugbear postfix/error[17321]: 6602F1C151: to=<mugbear@gmail.com>,relay=none,delay=0.03,delays=0.02/0/0/0.01,dsn=4.3.5,status=deferred (delivery temporarily suspended: Host or domain name not found. Name service error for name=xen.prgmr.com type=A: Host found but no data record of requested type)

更新到edit4:我运行,dpkg-reconfigure postfix和选定的Internet站点.

你没有正确安装postfix?如是 :
service postfix restart

纳米/etc/php.ini

找到sendmail_path,将行改为sendmail_path = /usr/sbin/sendmail.postfix -t -i

这是php客户端http://setahost.com/installing-postfix-as-a-default-mail-sending-program-with-php/的完整服务器/客户端安装说明

按照客户安装说明…

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读