如何使用System.Net.Mail设置弹跳地址? [英] How to set the bounce address using System.Net.Mail?

查看:188
本文介绍了如何使用System.Net.Mail设置弹跳地址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试实施可变包络返回路径(VERP)方法来管理电子邮件地址(即当我发送的电子邮件退回我希望它发送到特定的电子邮件地址,以便我可以更新我的数据库,以避免将来发送电子邮件到该电子邮件地址)。

I'm trying to implement the Variable envelope return path (VERP) method to manage email addresses (ie when an email I send bounces back I want it to be sent to a specific email address so that I can update my database to avoid sending emails to that email address in the future).

根据这篇文章,可以指定电子邮件地址a反弹邮件被发送到。如何在.Net中执行此操作?

According to this article it is possible to specify the email address a bounce email is sent to. How do you do this in .Net?

例如说我(me@myserver.com)想发送一封电子邮件给你(you@yourserver.com)。如果you@yourserver.com不再存在,我希望您的服务器将反弹邮件发送到bounce-you=yourserver.com@myserver.com)。这样当我收到这个退回的电子邮件,我知道you@yourserver.com不再是一个有效的电子邮件地址,我可以相应地更新我的数据库。

For example say I (me@myserver.com) want to send an email to you (you@yourserver.com). If you@yourserver.com doesn't exist anymore I want yourserver to send the bounce email to bounce-you=yourserver.com@myserver.com). This way when I receive this bounced email I know that you@yourserver.com is not a valid email address anymore and I can update my database accordingly.

在此示例中,跳出地址将是:bounce-you=yourserver.com@myserver.com

如何使用系统指定.net.Mail?

In this example, the bounce address would be: bounce-you=yourserver.com@myserver.com
How do you specify it using System.Net.Mail?

推荐答案

底线是你不能在.NET中这样做。您只能设置FROM地址,System.Net.Mail也将用作Envelope-From。

The bottom line is that you cannot do this in .NET. You can only set the FROM address, which System.Net.Mail will also use as the Envelope-From.

要执行此操作,您需要使用第三方SMTP对象像我写的那样:

To do something like this, you would need to use a 3rd party SMTP object like the one I wrote:

http:/ /www.aspnetemail.com

在aspNetEmail中,您可以执行以下操作:

In aspNetEmail, you can do something like:

EmailMessage msg = new EmailMessage();
msg.ReversePath = "bounceEmailAccountHere@whatever.com

aspNetEmail将使用ReversePath值在SMTP会话期间的MAIL FROM命令我可以很容易地调用此属性ReturnPath或EnvelopeFrom。回想起来,EnvelopeFrom将是一个更好的名称。

aspNetEmail will use the ReversePath value in the MAIL FROM command during the SMTP Session. I could have easily of called this property "ReturnPath" or "EnvelopeFrom". In retrospect, EnvelopeFrom would have been a better name.

这篇关于如何使用System.Net.Mail设置弹跳地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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