1,105,644 Community Members

c# Email sender property and return path

Member Avatar
sam1
Posting Whiz
301 posts since Nov 2004
Reputation Points: 0 [?]
Q&As Helped to Solve: 1 [?]
Skill Endorsements: 0 [?]
 
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

Member Avatar
thines01
Postaholic
2,420 posts since Oct 2009
Reputation Points: 389 [?]
Q&As Helped to Solve: 413 [?]
Skill Endorsements: 10 [?]
Team Colleague
Featured
 
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 three months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: