2

I'm writing a server that will send email to many recipients on behalf of my client.

The email must come from the client's email address (client@example.org), but I want to automatically handle bounces via VERP. Basically, the email From: header will be client@example.org, but the SMTP envelope sender (MAIL FROM) will be unique-email-id@my-email-service.example.com.

I've already built a multi-threaded sending engine that uses the built-in System.Net.Mail.SmtpClient to actually speak SMTP with the recipient's MX server.

Unfortunately, SmtpClient does not allow you to specify the envelope sender – it just uses the From: address.

I need an alternative that allows me to specify the SMTP MAIL FROM. Preferably, something that takes little work to drop in and replace SmtpClient.

Thus far, everything I've looked at is an entire email suite (SMTP/POP3/IMAP/kitchen sink). What lightweight SMTP libraries are available?

4

1 回答 1

0

System.Net.Mail.SmtpClient内部mailMessage.Sender ?? mailMessage.From用于信封MAIL FROM信封发件人。

不幸的是,虽然您可以使用 Sender 属性来指定MAIL FROM使用该属性的信封信封发件人mailMessage.Sender,但 SmtpClient 还将添加一个Sender: unique-email-id@domain.com标头。

使用此 Sender 标头,电子邮件客户端然后显示发送自unique-email-id@domain.com on behalf of John Doe <doe@domain.com>

我发现没有像样的开源 Smtp 库支持这一点——甚至 Mono 的 SmtpClient 也缺少这个特性。一些支持 VERP 的库:

PS:请随意投票支持 VERP 功能请求:http: //visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/3800792-smtpclient-should-allow-to-specify-the-envelope-se

相关问题:如何在 .NET 中实现 VERP(可变信封返回路径)?

于 2013-04-02T08:44:47.387 回答