问题描述
我正在尝试实施方法来管理电子邮件地址(即当我发送的电子邮件退回我希望它发送到特定的电子邮件地址,以便我可以更新我的数据库,以避免将来发送电子邮件到该电子邮件地址)。
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?
例如说我([email protected])想发送一封电子邮件给你([email protected])。如果[email protected]不再存在,我希望您的服务器将反弹邮件发送到[email protected])。这样当我收到这个退回的电子邮件,我知道[email protected]不再是一个有效的电子邮件地址,我可以相应地更新我的数据库。
For example say I ([email protected]) want to send an email to you ([email protected]). If [email protected] doesn't exist anymore I want yourserver to send the bounce email to [email protected]). This way when I receive this bounced email I know that [email protected] is not a valid email address anymore and I can update my database accordingly.
在此示例中,跳出地址将是:[email protected]
如何使用系统指定.net.Mail?
In this example, the bounce address would be: [email protected]
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:
在aspNetEmail中,您可以执行以下操作:
In aspNetEmail, you can do something like:
EmailMessage msg = new EmailMessage();
msg.ReversePath = "[email protected]
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设置弹跳地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!