我很头疼,因为PHP mail()函数不起作用。我已经重新安装了postfix应用程序,但仍然没有变化! 如果我在端口25中telnet到localhost,我可以从命令行发送邮件
root@server:/etc/postfix# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 myserver.com.br ESMTP Postfix
ehlo
401 Syntax: EHLO hostname
ehlo localhost
250-myserver.com.br
250-PIPELINING
250-SIZE 10240000
250-ETRN
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from: info@myserver.com.br
250 2.1.0 Ok
rcpt to: testes@gmail.com
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
Subject: Ola
Boas t
.
250 2.0.0 Ok: queued as A71558AB472
我以前安装过Zpanel,不知道这是不是弄乱了PHP邮件......还有什么可以呢?
我正在使用的PHP mail()函数非常简单,可以在其他服务器上运行:
mail("testes@hotmail.com","Tell","and","FROM: info@myserver.com.br\n\n");
我得到的错误日志是这样的:
Nov 19 15:28:43 myserver postfix/pickup[6186]: 89B898AB477: uid=33 from=<www-data>
Nov 19 15:28:43 myserver postfix/cleanup[6630]: 89B898AB477: message-id=<20131119172843.89B898AB477@myserver.com.br>
Nov 19 15:28:43 myserver postfix/qmgr[6187]: 89B898AB477: from=<www-data@myserver.com.br>, size=361, nrcpt=1 (queue active)
Nov 19 15:28:44 myserver postfix/smtp[6634]: 89B898AB477: to=<testes@hotmail.com>, relay=mx1.hotmail.com[65.55.37.120]:25, delay=0.99, delays=0.17/0.01/0.6/0.2, dsn=4.0.0, status=SOFTBOUNCE (host mx1.hotmail.com[65.55.37.120] said: 550 SC-001 (COL0-MC4-F39) Unfortunately, messages from 201.33.21.60 weren't sent. Please contact your Internet service provider since part of their network is on our block list. You can also refer your provider to http://mail.live.com/mail/troubleshooting.aspx#errors. (in reply to MAIL FROM command))
Nov 19 15:28:44 myserver postfix/smtp[6634]: 89B898AB477: lost connection with mx1.hotmail.com[65.55.37.120] while sending RCPT TO
编辑:现在想出我可以将此电子邮件发送到另一台服务器,但不知何故Hotmail阻止了它。
答案 0 :(得分:0)
似乎 hotmail 不喜欢信封发件人www-data@myserver.com.br
(在MAIL FROM:
中使用)
使用telnet查看hotmail是否已准备好接受来自主机的邮件以及其他信封发件人地址(www-数据可能不受欢迎/阻止)。
如果您使用sendmail程序配置php邮件发送(postfix也提供此类程序),那么您可以设置另一个信封发件人。
答案 1 :(得分:0)
所以似乎hotmail阻止了我的消息......我试图向GMAIL发送一些消息,第一个就出来了。 接下来的电子邮件我收到了以下日志
Nov 20 09:26:31 Server postfix/smtp[11729]: connect to gmail-smtp-in.l.google.com[2607:f8b0:400c:c02::1a]:25: Network is unreachable
Nov 20 09:26:32 Server postfix/smtp[11729]: 5A2238AB497: to=<teste@gmail.com>, relay=gmail-smtp-in.l.google.com[173.194.68.26]:25, delay=1.8, delays=0.17/0/1/0$
Nov 20 09:26:32 Server postfix/qmgr[7005]: 5A2238AB497: removed
Nov 20 09:28:20 Server postfix/smtpd[12027]: connect from localhost[127.0.0.1]
Nov 20 09:28:20 Server postfix/trivial-rewrite[12029]: warning: do not list domain myserver.com.br in BOTH mydestination and virtual_mailbox_domains
Nov 20 09:28:20 Server postfix/smtpd[12027]: ACCD08AB497: client=localhost[127.0.0.1]
Nov 20 09:28:20 Server postfix/cleanup[12031]: ACCD08AB497: message-id=<1384946900.528c9cd49418a@www.myserver.com.br>
Nov 20 09:28:20 Server postfix/qmgr[7005]: ACCD08AB497: from=<info@myserver.com.br>, size=1260, nrcpt=1 (queue active)
Nov 20 09:28:20 Server postfix/smtpd[12027]: disconnect from localhost[127.0.0.1]
经过一些搜索,我发现问题出在ipv6配置上,所以我编辑了postfix / main.cf和inet_protocols = All到inet_protocols = ipv4。
新输出是这样的
Nov 20 09:54:49 Server postfix/smtp[12315]: 70A3A8AA103: to=<teste@gmail.com>, relay=gmail-smtp-in.l.google.com[173.194.68.27]:25, delay=2, delays=0.21/0/0.4/1.4, dsn=2.0.0, status=sent (250 2.0.0 OK 1384948492 d5si7115120qcj.49 - gsmtp)
Nov 20 09:54:49 Server postfix/qmgr[12243]: 70A3A8AA103: removed
但是这位收件人没有收到他的电子邮件,虽然状态良好:(
答案 2 :(得分:0)