Hi Mariya,
Thanks for the reply. Sorry for the delay in my answer, I've somehow missed the notification.
Here is the code snippet I use.
You will notice the different MailMessage.From and MailMessage.Sender
| using(MailMessagemailMsg=newMailMessage()) |
| { |
| mailMsg.Subject="Subject"; |
| mailMsg.Body="Content"; |
| mailMsg.To.Add(newMailAddress("null@example.com")); |
| mailMsg.ReplyTo=newMailAddress(string.Format("\"{0}\"<{1}>","exampleReply","exampleReply@test.local")); |
| mailMsg.From=newMailAddress(string.Format("\"{0}\"<{1}>","exampleFrom","exampleFrom@test.local")); |
| mailMsg.Sender=newMailAddress("bounce@example.com"); |
|
| SmtpClientclient=newSmtpClient |
| { |
| Host="localhost", |
| DeliveryMethod=SmtpDeliveryMethod.Network, |
| //DeliveryMethod=SmtpDeliveryMethod.PickupDirectoryFromIis, |
| }; |
|
| client.Send(mailMsg); |
| } |
if I use the first delivery method (SmtpDeliveryMethod.Network), and I analyze the packets using Wireshark, here is what I have
23049 109.881909 192.168.XX.XXX 66.XXX.XX.XXX SMTP C: MAIL FROM:<bounce@example.com> SIZE=663
If I use SmtpDeliveryMethod.PickupDirectoryFromIis as my delivery method, here is what I see
32163 153.352097 192.168.XX.XXX 66.XXX.XX.XXX SMTP C: MAIL FROM:<exampleFrom@test.local> SIZE=601
Obviously the first result is the one I would like to keep.
Thanks