从 PHP 应用程序/Linux 服务器发送电子邮件时出现问题

发布于 2024-11-16 05:55:58 字数 9447 浏览 1 评论 0原文

我在从 Linux 机器发送电子邮件时遇到问题。该应用程序发送多封不同的电子邮件,它使用 PHP(mail() 函数)/qmail (SMTP) 发送电子邮件。有些电子邮件被正确发送到目的地,但有些客户在应该收到电子邮件时却接到了一些未收到电子邮件的人打来的电话。 这是证明电子邮件已发送的日志。但没有发送?或者是吗?

Jun  8 11:46:34 ds1111 sendmail[19207]: p58AkYSx019207: from=apache, size=2053, class=0, nrcpts=1, msgid=<[email protected]>, relay=apache@localhost
Jun  8 11:46:34 ds1111 /var/qmail/bin/relaylock[19208]: /var/qmail/bin/relaylock: mail from 127.0.0.1:40345 (localhost)
Jun  8 11:46:34 ds1111 sendmail[19207]: STARTTLS=client, relay=[127.0.0.1], version=TLSv1/SSLv3, verify=FAIL, cipher=DHE-RSA-AES256-SHA, bits=256/256
Jun  8 11:46:34 ds1111 qmail-queue-handlers[19210]: Handlers Filter before-queue for qmail started ...
Jun  8 11:46:34 ds1111 qmail-queue-handlers[19210]: [email protected]
Jun  8 11:46:34 ds1111 qmail-queue-handlers[19210]: [email protected]

Jun  8 11:46:34 ds1111 qmail-queue-handlers[19210]: hook_dir = '/usr/local/psa/handlers/before-queue'
Jun  8 11:46:34 ds1111 qmail-queue-handlers[19210]: recipient[3] = '[email protected]'


Jun  8 11:46:34 ds1111 qmail-queue-handlers[19210]: handlers dir = '/usr/local/psa/handlers/before-queue/recipient/[email protected]'
Jun  8 11:46:34 ds1111 qmail-queue-handlers[19210]: starter: submitter[19211] exited normally
Jun  8 11:46:34 ds1111 qmail: 1307529994.690886 new msg 49580354
Jun  8 11:46:34 ds1111 qmail: 1307529994.691052 info msg 49580354: bytes 2539 from <[email protected]> qp 19211 uid 2020
Jun  8 11:46:34 ds1111 sendmail[19207]: p58AkYSx019207: [email protected], ctladdr=apache (48/48), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=32053, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (ok 1307529994 qp 19210)
Jun  8 11:46:34 ds1111 qmail: 1307529994.695376 starting delivery 100548: msg 49580354 to remote [email protected]


Jun  8 11:46:34 ds1111 qmail: 1307529994.695467 status: local 0/10 remote 1/20
Jun  8 11:46:34 ds1111 qmail-remote-handlers[19212]: Handlers Filter before-remote for qmail started ...

Jun  8 11:46:34 ds1111 qmail-remote-handlers[19212]: [email protected]
Jun  8 11:46:34 ds1111 qmail-remote-handlers[19212]: [email protected]





Jun  8 11:46:34 ds1111 qmail-remote-handlers[19212]: hook_dir = '/usr/local/psa/handlers/before-remote'
Jun  8 11:46:34 ds1111 qmail-remote-handlers[19212]: recipient[3] = '[email protected]'
Jun  8 11:46:34 ds1111 qmail-remote-handlers[19212]: handlers dir = '/usr/local/psa/handlers/before-remote/recipient/[email protected]'





Jun  8 11:46:34 ds1111 sendmail[19213]: p58AkYYN019213: from=apache, size=2053, class=0, nrcpts=1, msgid=<[email protected]>, relay=apache@localhost
Jun  8 11:46:34 ds1111 /var/qmail/bin/relaylock[19214]: /var/qmail/bin/relaylock: mail from 127.0.0.1:40347 (localhost)
Jun  8 11:46:34 ds1111 sendmail[19213]: STARTTLS=client, relay=[127.0.0.1], version=TLSv1/SSLv3, verify=FAIL, cipher=DHE-RSA-AES256-SHA, bits=256/256
Jun  8 11:46:34 ds1111 qmail-queue-handlers[19216]: Handlers Filter before-queue for qmail started ...
Jun  8 11:46:34 ds1111 qmail-queue-handlers[19216]: [email protected]
Jun  8 11:46:34 ds1111 qmail-queue-handlers[19216]: [email protected]

Jun  8 11:46:34 ds1111 qmail-queue-handlers[19216]: hook_dir = '/usr/local/psa/handlers/before-queue'
Jun  8 11:46:34 ds1111 qmail-queue-handlers[19216]: recipient[3] = '[email protected]'
Jun  8 11:46:34 ds1111 qmail-queue-handlers[19216]: handlers dir = '/usr/local/psa/handlers/before-queue/recipient/[email protected]'
Jun  8 11:46:34 ds1111 qmail-queue-handlers[19216]: starter: submitter[19217] exited normally


Jun  8 11:46:34 ds1111 qmail: 1307529994.782765 new msg 49580355
Jun  8 11:46:34 ds1111 qmail: 1307529994.782801 info msg 49580355: bytes 2539 from <[email protected]> qp 19217 uid 2020
Jun  8 11:46:34 ds1111 sendmail[19213]: p58AkYYN019213: [email protected], ctladdr=apache (48/48), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=32053, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (ok 1307529994 qp 19216)
Jun  8 11:46:34 ds1111 qmail: 1307529994.787382 starting delivery 100549: msg 49580355 to remote [email protected]
Jun  8 11:46:34 ds1111 qmail: 1307529994.787469 status: local 0/10 remote 2/20



Jun  8 11:46:34 ds1111 qmail-remote-handlers[19218]: Handlers Filter before-remote for qmail started ...

Jun  8 11:46:34 ds1111 qmail-remote-handlers[19218]: [email protected]
Jun  8 11:46:34 ds1111 qmail-remote-handlers[19218]: [email protected]
Jun  8 11:46:34 ds1111 qmail-remote-handlers[19218]: hook_dir = '/usr/local/psa/handlers/before-remote'
Jun  8 11:46:34 ds1111 qmail-remote-handlers[19218]: recipient[3] = '[email protected]'
Jun  8 11:46:34 ds1111 qmail-remote-handlers[19218]: handlers dir = '/usr/local/psa/handlers/before-remote/recipient/[email protected]'
Jun  8 11:46:35 ds1111 qmail: 1307529995.139502 delivery 100549: success: 194.154.172.203_accepted_message./Remote_host_said:_250_ok:__Message_20026590_accepted/
Jun  8 11:46:35 ds1111 qmail: 1307529995.139597 status: local 0/10 remote 1/20
Jun  8 11:46:35 ds1111 qmail: 1307529995.139626 end msg 49580355





Jun  8 11:46:35 ds1111 qmail: 1307529995.407398 delivery 100548: success: 209.85.143.27_accepted_message./Remote_host_said:_250_2.0.0_OK_1307529909_fy2si1026718wbb.104/
Jun  8 11:46:35 ds1111 qmail: 1307529995.407551 status: local 0/10 remote 0/20
Jun  8 11:46:35 ds1111 qmail: 1307529995.407617 end msg 49580354

I have a problem sending email from a linux machine. The application sends several different emails, and it uses PHP (the mail() function) / qmail (SMTP) to send emails. Some emails are sent correctly to their destination, but some the clients get some phone calls from people who haven’t received it when they should.
Here is a log to prove that the email is sent. But it isn't sent ? Or is it ?

Jun  8 11:46:34 ds1111 sendmail[19207]: p58AkYSx019207: from=apache, size=2053, class=0, nrcpts=1, msgid=<[email protected]>, relay=apache@localhost
Jun  8 11:46:34 ds1111 /var/qmail/bin/relaylock[19208]: /var/qmail/bin/relaylock: mail from 127.0.0.1:40345 (localhost)
Jun  8 11:46:34 ds1111 sendmail[19207]: STARTTLS=client, relay=[127.0.0.1], version=TLSv1/SSLv3, verify=FAIL, cipher=DHE-RSA-AES256-SHA, bits=256/256
Jun  8 11:46:34 ds1111 qmail-queue-handlers[19210]: Handlers Filter before-queue for qmail started ...
Jun  8 11:46:34 ds1111 qmail-queue-handlers[19210]: [email protected]
Jun  8 11:46:34 ds1111 qmail-queue-handlers[19210]: [email protected]

Jun  8 11:46:34 ds1111 qmail-queue-handlers[19210]: hook_dir = '/usr/local/psa/handlers/before-queue'
Jun  8 11:46:34 ds1111 qmail-queue-handlers[19210]: recipient[3] = '[email protected]'


Jun  8 11:46:34 ds1111 qmail-queue-handlers[19210]: handlers dir = '/usr/local/psa/handlers/before-queue/recipient/[email protected]'
Jun  8 11:46:34 ds1111 qmail-queue-handlers[19210]: starter: submitter[19211] exited normally
Jun  8 11:46:34 ds1111 qmail: 1307529994.690886 new msg 49580354
Jun  8 11:46:34 ds1111 qmail: 1307529994.691052 info msg 49580354: bytes 2539 from <[email protected]> qp 19211 uid 2020
Jun  8 11:46:34 ds1111 sendmail[19207]: p58AkYSx019207: [email protected], ctladdr=apache (48/48), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=32053, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (ok 1307529994 qp 19210)
Jun  8 11:46:34 ds1111 qmail: 1307529994.695376 starting delivery 100548: msg 49580354 to remote [email protected]


Jun  8 11:46:34 ds1111 qmail: 1307529994.695467 status: local 0/10 remote 1/20
Jun  8 11:46:34 ds1111 qmail-remote-handlers[19212]: Handlers Filter before-remote for qmail started ...

Jun  8 11:46:34 ds1111 qmail-remote-handlers[19212]: [email protected]
Jun  8 11:46:34 ds1111 qmail-remote-handlers[19212]: [email protected]





Jun  8 11:46:34 ds1111 qmail-remote-handlers[19212]: hook_dir = '/usr/local/psa/handlers/before-remote'
Jun  8 11:46:34 ds1111 qmail-remote-handlers[19212]: recipient[3] = '[email protected]'
Jun  8 11:46:34 ds1111 qmail-remote-handlers[19212]: handlers dir = '/usr/local/psa/handlers/before-remote/recipient/[email protected]'





Jun  8 11:46:34 ds1111 sendmail[19213]: p58AkYYN019213: from=apache, size=2053, class=0, nrcpts=1, msgid=<[email protected]>, relay=apache@localhost
Jun  8 11:46:34 ds1111 /var/qmail/bin/relaylock[19214]: /var/qmail/bin/relaylock: mail from 127.0.0.1:40347 (localhost)
Jun  8 11:46:34 ds1111 sendmail[19213]: STARTTLS=client, relay=[127.0.0.1], version=TLSv1/SSLv3, verify=FAIL, cipher=DHE-RSA-AES256-SHA, bits=256/256
Jun  8 11:46:34 ds1111 qmail-queue-handlers[19216]: Handlers Filter before-queue for qmail started ...
Jun  8 11:46:34 ds1111 qmail-queue-handlers[19216]: [email protected]
Jun  8 11:46:34 ds1111 qmail-queue-handlers[19216]: [email protected]

Jun  8 11:46:34 ds1111 qmail-queue-handlers[19216]: hook_dir = '/usr/local/psa/handlers/before-queue'
Jun  8 11:46:34 ds1111 qmail-queue-handlers[19216]: recipient[3] = '[email protected]'
Jun  8 11:46:34 ds1111 qmail-queue-handlers[19216]: handlers dir = '/usr/local/psa/handlers/before-queue/recipient/[email protected]'
Jun  8 11:46:34 ds1111 qmail-queue-handlers[19216]: starter: submitter[19217] exited normally


Jun  8 11:46:34 ds1111 qmail: 1307529994.782765 new msg 49580355
Jun  8 11:46:34 ds1111 qmail: 1307529994.782801 info msg 49580355: bytes 2539 from <[email protected]> qp 19217 uid 2020
Jun  8 11:46:34 ds1111 sendmail[19213]: p58AkYYN019213: [email protected], ctladdr=apache (48/48), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=32053, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (ok 1307529994 qp 19216)
Jun  8 11:46:34 ds1111 qmail: 1307529994.787382 starting delivery 100549: msg 49580355 to remote [email protected]
Jun  8 11:46:34 ds1111 qmail: 1307529994.787469 status: local 0/10 remote 2/20



Jun  8 11:46:34 ds1111 qmail-remote-handlers[19218]: Handlers Filter before-remote for qmail started ...

Jun  8 11:46:34 ds1111 qmail-remote-handlers[19218]: [email protected]
Jun  8 11:46:34 ds1111 qmail-remote-handlers[19218]: [email protected]
Jun  8 11:46:34 ds1111 qmail-remote-handlers[19218]: hook_dir = '/usr/local/psa/handlers/before-remote'
Jun  8 11:46:34 ds1111 qmail-remote-handlers[19218]: recipient[3] = '[email protected]'
Jun  8 11:46:34 ds1111 qmail-remote-handlers[19218]: handlers dir = '/usr/local/psa/handlers/before-remote/recipient/[email protected]'
Jun  8 11:46:35 ds1111 qmail: 1307529995.139502 delivery 100549: success: 194.154.172.203_accepted_message./Remote_host_said:_250_ok:__Message_20026590_accepted/
Jun  8 11:46:35 ds1111 qmail: 1307529995.139597 status: local 0/10 remote 1/20
Jun  8 11:46:35 ds1111 qmail: 1307529995.139626 end msg 49580355





Jun  8 11:46:35 ds1111 qmail: 1307529995.407398 delivery 100548: success: 209.85.143.27_accepted_message./Remote_host_said:_250_2.0.0_OK_1307529909_fy2si1026718wbb.104/
Jun  8 11:46:35 ds1111 qmail: 1307529995.407551 status: local 0/10 remote 0/20
Jun  8 11:46:35 ds1111 qmail: 1307529995.407617 end msg 49580354

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

妖妓 2024-11-23 05:55:58

已发送!=已收到。有多种原因可能导致此问题:

  1. 收件人的邮件服务器无法接收邮件。
  2. 收件人的邮件服务器将该邮件标记为垃圾邮件。
  3. 收件人的邮件客户端将该邮件标记为垃圾邮件。
  4. 收件人删除了该消息并忘记告诉您。

还有更多。您的日志未指示错误,因此您可能需要检查接收端的问题。您可以更改邮件内容以避免垃圾邮件过滤器(如果出现问题),并确保您的主机没有被任何垃圾邮件黑名单组织列入黑名单。

sent != received. There are several things that could cause this issue:

  1. The recipient's mail server failed to receive the message.
  2. The recipient's mail server marked the message as spam.
  3. The recipient's mail client marked the message as spam.
  4. The recipient deleted the message and forgot to tell you.

and many more. Your log does not indicate errors, so you may need to examine the problem on the receiving end. You can change the content of the messages to avoid spam filters if that turns out to be the problem, and ensure that your host is not blacklisted with any of the spam blacklisting organizations.

一片旧的回忆 2024-11-23 05:55:58

根据电子邮件的性质,一旦它离开您的系统,它就脱离了您的控制。当它离开您的系统时,它会通过多个跃点到达接收者的主机,然后将其传递给客户端进行读取。在此期间,您的邮件必须避免超时、网络问题和至少两个垃圾邮件检查程序。

您可以通过检查垃圾邮件评级、消除伟哥或脏话等“触发”字词来确保更好的送达率换句话说,确保您只向选择加入的人发送邮件,并经常检查以确保您的服务器不在任何 黑名单。我的公司(代表我们的客户每月发送数百万封电子邮件)还对每个主机的邮件速率进行限制,因为如果您在特定时期内多次点击它们,许多主机将拒绝或严重减慢邮件发送速度。这些规则是什么,没有人真正知道,因此您必须对邮件系统进行性能调整。

通过“受信任”主机(例如 SocketLabs)发送也将大大提高您的送达率。

话虽这么说,如果有人告诉你他们可以 100% 保证每封电子邮件的送达,我就有一座桥梁可以卖给你......

By the nature of email, once it leaves your system it's out of your hands. When it leaves your system it goes via multiple hops to the recipient's host, which then passes it to the client to read. Over that time, your message has to avoid timeouts, network issues, and at least two spam checkers.

You can ensure better deliverability by checking spam ratings, eliminating "trigger" words such as Viagra or swear words, ensure that you're mailing only to people who have opted in, and checking frequently to make sure your server is not on any blacklists. My company (which sends millions of emails a month on behalf of our clients) also does per-host mail rate limiting as many hosts will deny or severely slow mailing if you've hit them too many time in a particular period. What those rules are, nobody really knows, so you have to performance tune your mailing system.

Sending via a "trusted" host such as SocketLabs will also greatly improve your deliverability.

All that being said, if anybody tells you that they can 100% guarantee the delivery of every email, I have a bridge to sell you.....

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文