How to set Return-Path header in Aspose.Email


#1

Currently all the topics related return-path in the forum are all with old library Aspose.Network.

We tried to setup ReturnPath/ReverseParth, but not working, any help for the latest version of Aspose.Email.


#2

@TMESS,

I have observed the requirements shared by you and have not been able to completely understand them. Can you please share the details of requirement that you want to achieve using Aspose.Email in the form of sample file, snapshot and used code.


#3

Sorry for any confusion. here’s more detail:
We try to use Aspose.Email to send email. and We set from as a user in our company but we want any bounce email/error report send to another email other than the user’s email(From header). I read all the posts here about the return-path header/MAIL FROM, etc that related to this requirements and the solution I find is to set the bounce/error report email to ReversePath properity in MailMessage object. But actually it doesn’t work, the bounce email still send back to the user’s email.

here’s our code:

        MailMessage mail = new MailMessage();
        mail.ReversePath = "postmaster@example.com";
        mail.Body = "test";
        mail.Subject = "test return path";
        mail.From = new MailAddress("user1@example.com");
        mail.To = new MailAddressCollection();
        mail.To.Add(new MailAddress("client@otherexample.com"));
        
        SmtpClient smtp=new SmtpClient("smtp server ip", 25);
        
        smtp.Send(mail);

#5

@TMESS,

We have observed the issue on our end and it seems to be an issue with API. An issue with ID EMAILNET-39597 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.


#6

Thanks for the ticket.
Just more details hope to help you.
I use the latest Aspose.Email nuget Package 19.9 and the dll is ‘Aspose.Email for .NET 4.0’

the issue is similar to


but it doesn’t work now in Send method as well.

And I also enabled the log like the guy did in above topic and I can see similar logs,
the MAIL FROM is always the user’s email not taken from ReversePath.


#7

@TMESS,

Thank you for sharing the information. We will share the good news with you as soon as the issue will be addressed.