1.11M Members

c# Email sender property and return path

 
0
 

Currently sending emails and setting the Return-path of an email(System.Net.Mail) works if i put :

MailMessage msg = new MailMessage();
msg.Sender = new MailAddress("not-deliviered@sample.org");
msg.Headers.Add("Return-Path", sReturnPath);

but if I send a successful email it would say delivered on behalf of the email above....

any ideas how to resolve this not to put 'on behalf of' but if it bounces back should return to 'not-delivered'?

thanks

 
0
 

If I understand correctly, I would do it like this:

static void Main(string[] args)
      {
         SmtpClient smtp = new SmtpClient(_strSomeSmtpAddress);
         MailMessage msg = new MailMessage("SantaKlaus@gmail.com", "LittleKid@SomeCountry.com")
         {
            Subject = "Your Christmas Wish",
            Body = "1. SSP Racer Car with T-Stick",
            ReplyTo = new MailAddress("MomOfLittleKid@SomeCountry.com", "Santa Klaus")
         };

         smtp.Send(msg);
      }

...using an Exchange Server, this does not give any warnings or notices.

You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: