在 Web 应用程序中发送电子邮件
我用 PHP 构建各种 Web 应用程序。客户通常需要向用户或内部发送电子邮件通知。
我经常受到客户电话或电子邮件中说“乔·史密斯从未收到电子邮件通知,而我收到了”或类似内容的困扰。
跟踪我们实际通过您的网络应用程序发送的电子邮件的最佳方式是什么?我不关心他们离开我的网络服务器后的跟踪,我只想要一个日志“是的,该电子邮件已发送给乔并被密件抄送给总办公室邮箱”。
我收到了这家公司发送的促销资料 - 点击 - 但它处于测试阶段。有人知道/使用过类似的服务等吗?
I build various web applications in PHP. Clients usually have the need for sending either email notification to users or internally.
I am plagued quite often by clients phone or emailing saying "joe smith never got the email notification and I did" or similar.
What is the best way to track email that actually we sent by your web app. I don't care about tracking after they leave my web server, I just want a log of "yes, that email got sent to joe and was bcc'd to the general office mailbox".
I have had promotional stuff sent from this company - click - but it is in beta. Does anyone know / used similar services etc?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
假设您的网站使用“本地”邮件服务器,例如 Postfix/Sendmail/Exim,您需要检查邮件日志。一般来说(在 Unix-ish 系统上),它是 /var/log/maillog。它将包含电子邮件通过邮件服务器的完整记录,从电子邮件从 PHP 移交到收件人手中。
然而,一些接受服务器会就邮件向您撒谎 - 他们会使用通常的“200 OK”成功代码接受它,然后将其转储到垃圾箱中,因为它触发了垃圾邮件过滤器或您的 IP/IP 块已被阻止。某处列入黑名单。
您可以在邮件中嵌入一个网络错误,以便(希望)客户端的电子邮件程序在阅读邮件时能够对您的服务器执行 ping 操作,但大多数邮件客户端现在默认阻止远程图像,因此这也是非常不可靠的。
基本上,电子邮件是一项尽力而为但不能保证成功的业务,整个系统的设计目的就是在所有事情上对您撒谎。
Presuming your website uses a "local" mail server, such as Postfix/Sendmail/Exim, you'd check the mail log. Generally (on Unix-ish systems), that's /var/log/maillog. It'll contain the full transcript of the email's passage through the mail server, from the moment it was handed off from PHP to when it goes out the door to the recipient.
However, some accepting servers will LIE to you about the mail - they'll accept it with the usual "200 OK" success code, then just dump it in the trash because it triggered a spam filter or your IP/IP-block has been blacklisted somewhere.
You could embed a web bug in the mail so that (hopefully) the client's email program will ping your server whenever they read the mail, but most mail clients now block remote images by default, so this is very unreliable as well.
Basically, email is a best-effort-not-guaranteed-to-succeed business, and the entire system is set up to lie to you about everything.
通常,当您调用邮件函数时,php 会使用某种邮件程序。该程序应该有一个日志。例如我们使用postfix。如果我想检查电子邮件是否已发送:我只需引用后缀日志。
Usually, php uses some sort of mailing program when you call the mail function. That program should have a log. For example, we use postfix. If I want to check if an email was sent: I just reference the postfix log.