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

查看:111
本文介绍了如何使用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).

根据这篇文章,可以指定电子邮件地址的反弹电子邮件发送给。你如何在.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已经不存在我想yourserver发送反弹邮件给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
如何使用System.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中做到这一点。您只能设置发件人地址,这System.Net.Mail也将作为信件来自使用。

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将在SMTP会话期间使用MAIL FROM命令的ReversePath值。我可以很容易的被称为这个属性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天全站免登陆