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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.