在webapp中处理未传递的电子邮件 [英] Handling undelivered emails in webapp

查看:147
本文介绍了在webapp中处理未传递的电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有典型的商务webapp,允许我们的用户发送电子邮件给他们的客户。我们在FROM字段中设置用户电子邮件,以便客户端可以直接重播给用户。问题是,由于SMTP协议未通过电子邮件通知返回到我们的电子邮件地址(我们发送电子邮件的帐户的地址)。

We have typical bussiness webapp that allows our users send e-mails with offerings to their clients. We set user e-mail in FROM field so the client can replay directly to te user. The problem is that because of SMTP protocol undeliverd e-mail notification is returned to our e-mail adress(the address of the account we send e-mails from).

你知道优雅的方式来处理这个未传递的电子邮件吗?我的意思是让发件人知道他的邮件没有交付的最简单的方法。

Do you know elegant way to handle this undelivered emails? I mean the easiest way to let the sender know that his mail was not delivered.

推荐答案

首先,了解差异很重要在From:标头(收件人在其电子邮件客户端中看到)和发件人地址(也称为信封返回路径,或SMTPMAIL FROM命令的参数)之间。发件人地址是电子邮件无法传送的地方,因此其他名称返回路径。

First, it's important to understand the difference between the "From:" header (which the recipient sees in their email client) and the sender address (which is also called the envelope return path, or the argument to the SMTP "MAIL FROM" command). The sender address is where bounce messages go when the email can't be delivered, hence the other name return path.

SMTP不会限制您使用的地址发件人地址(除了它必须通过语法有效),但是您使用的任何SMTP客户端库可能都有,所以您需要检查出来。

SMTP doesn't restrict what address you use as the sender address (except that it must by syntactically valid), but whatever SMTP client library you use might, so you'll need to check that out.

更改发件人地址是您可以做聪明的事情来帮助检测电子邮件退回并将其报告回webapp或发件人。最常见的事情是将发件人地址中的收件人地址编码,例如发件人地址如下:sender+recipient=recipientdomain.com@senderdomain.com。负责senderdomain.com的MTA需要知道将sender+foo@senderdomain.com的所有电子邮件发送到sender@senderdomain.com - 但这是一个相当普遍的要求。然后,您收到收到的电子邮件,而不是尝试从收件人的内容(可能是任何格式)的退回邮件中解决,您可以从收件人地址获取。

Changing the sender address is where you can do clever things to help detect email bounces and report them back to the webapp or sender. The most common thing you'll see is to encode the recipient address in the sender address, e.g. with a sender address like this: sender+recipient=recipientdomain.com@senderdomain.com. The MTA responsible for senderdomain.com needs to know to deliver all emails for sender+foo@senderdomain.com to sender@senderdomain.com -- but that's a fairly common requirement. Then you take the email that is received, and instead of trying to work out from the bounce message in the contents (which could be in any format) who the recipient was, you can get it right from the recipient address.

您也可以做更复杂的事情,比如哈希收件人地址,因此它不会直接在发件人地址中看到,例如sender+e72fab38fb@senderdomain.com。您可以为发送的电子邮件添加一些标识符,以防发送多个电子邮件到同一个地址,并想知道哪个邮件弹回。

You can do more complex things as well, like hashing the recipient address so it's not visible directly in the sender address, e.g. sender+e72fab38fb@senderdomain.com. And you could include some identifier for the email that was sent, in case you're sending multiple emails to the same address and want to know which one bounced.

这些技巧称为可变信封返回路径或VERP,通常由邮件列表软件实现。

These tricks are called Variable Envelope Return Path or VERP, and are commonly implemented by mailing list software.

这篇关于在webapp中处理未传递的电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆