使用 PHP 跟踪 SMTP 发送的电子邮件

发布于 2024-12-15 17:31:36 字数 420 浏览 1 评论 0原文

我正在开发一个小型电子邮件发送器门户,允许注册用户发送一定数量的电子邮件。我使用与本地主机上安装的 SMTP 服务器(我的意思是 Apache 和 PHP 的同一服务器)进行安全连接来发送电子邮件,并且我已经实现了一个系统来控制发送的电子邮件量(我安排将电子邮件发送到避免同时发送太多电子邮件)。

我使用 PHPMAiler 类来发送电子邮件,并使用我自己的类来安排它们。

我唯一错过的是跟踪我发送的电子邮件,以了解是否发生了一些错误(以及具体的错误,即未找到地址、收件人邮箱已满等...)并了解用户是否打开了电子邮件以及何时。

我承认我实际上对 SMTP 服务器几乎一无所知,但我想知道是否有一些资源可以找到可以与 SMTP 服务器通信以询问其发送的电子邮件的 PHP 类,或者是否有任何PHP 中的方法来检索发送的电子邮件信息......或任何其他可能对我的目的有用的内容。

I'm developing a little email sender portal that allows registered users to send some amounts of emails. I use a secure connection with an SMTP server installed on localhost (I mean same server of Apache and PHP) to send the emails and I have implemented a system to take control on the amounts of emails sent (I schedule the sending of the emails to avoid sending too much emails at the same time).

I use PHPMAiler class to send the emails and a class of my own to schedule them.

The only thing I miss is to track the emails I've sent to know if some errors occured (and which error in particular ie. address not found, recipient mailbox full, etc...) and to know if the user opened the email and when.

I admit that I actually know almost nothing about SMTP servers, but I'd like to know if there are some resources where I can find a PHP class that can talk to the SMTP server to ask it for the sent emails, or if there's any way in PHP to retreive sent emails information.... or anything else that could be useful for my purposes.

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

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

发布评论

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

评论(2

梦忆晨望 2024-12-22 17:31:36

不幸的是,一旦 SMTP 服务器将电子邮件发送到收件人邮件服务器,就无法“跟踪”电子邮件。

如果接收电子邮件服务器遇到错误,它会自动将错误消息发送到发件人地址。这可能是尝试发送电子邮件的注册用户的电子邮件地址。

希望这有帮助。

Unfortunately there is no way to 'track' email once the SMTP server has send it to the recipients mailserver.

If the receiving email server encounters an error it will automatically send the error message to the sender address. This will probably be the e-mail adres of the registered user who tries the send the email.

Hope this helps.

早茶月光 2024-12-22 17:31:36

一旦电子邮件离开,就无法对其进行跟踪,但您有两个选择。一是检查退回的消息。通常,传出邮件将指定退回邮件将前往的返回路径。

另一种选择是您确实可以控制发送服务器。例如,如果您要发送到的服务器是抱怨用户丢失的服务器,那么您将收到 SMTP 错误代码之一。 SMTP 错误代码与 HTTP 错误代码几乎相反,500 是硬退回(永久性错误,例如此处不知道用户)和 400 是软退回(临时错误)。

最后,还可以添加一个小图像(将通过您的 php 脚本呈现)来跟踪电子邮件的打开情况,显然,如果用户阻止图像,这将无济于事,但它可以提供一些用户已阅读的信息电子邮件(以及链接跟踪)

There is no way to track the email once it leaves however you do have two options. One is to check for bounced messages. Normally outgoing messages will specify a return-path that the bounces will go to.

The other option is that you do have control of the sending server. If the server that you are sending to is the server that complains that the user is missing for example then you will receive one of the SMTP error codes. SMTP error codes are pretty much the oposite to HTTP ones in that 500's are hard bounces (permanent errors like user is not known here) and 400's soft bounces (temporary errors).

Finally it is also possible to add a small image (that will render via your php script) to track opens of an email, obviously this won't help if the user blocks the images but it can provide some idea that the user has read the emails (along with link tracking)

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