+2 votes

We are trying to redirect bounced email to a specific email address.

The Return-Path header is added by me because I want any bounce backs to be sent to this address support@example.com.

The built in VERP seems not to be working.

What are your suggestions to this?

by

1 Answer

0 votes

Please read this article first, as it seems to me that you don't entirely understand what VERP does: Variable Envelope Return Path in .NET

To have a correct VERP message your message should have:

From email header set to the original sender: from@example.com

  • To email header set to original recipient: to@invalid.com
  • unique MAIL FROM address during SMTP conversation: from+to=invalid.com@example.com
  • Return-path email header set to this unique address (from+to=invalid.com@example.com), usually as a result of setting this header with MAIL FROM value.

Setting Return-Path to static custom email address (support@example.com) denies all VERP purposes, as you can't decipher receiving (failed) address from the bounce message 'To' address.

The whole idea of VERP is that all invalid messages are bounced back to from@example.com account, but each has in fact different 'To' address (such as from+to=invalid.com@example.com).

You can then extract invalid address (to=invalid.com => to@invalid.com, use VERPAddress class for that), without the need on relying that the server generates correct failure notice (report).

IMail email = Limilabs.Mail.Fluent.Mail.Html("Body")
    .Subject("Subject")
    .From("from@example.com")
    .To("to@invalid.com")
    .Create();

SmtpMail smtpMail = SmtpMail.CreateUsingVERP(email);

using (Smtp smtp = new Smtp())
{
    smtp.ConnectSSL("smtp.example.com");
    smtp.UseBestLogin("user", "password");
    smtp.SendMessage(smtpMail);
    smtp.Close();
}
by (297k points)
...