We are creating an application in .Net and are currently on the final stages and need to inject an email message through SMTP while setting a variety of options in the 'email headers'.
The three values we are focused on are:
Currently in our code we have this:
BodyMessage.Sender = new MailAddress(bounce_address);
(Where the 'bounce_address' is the address we we want the bounces to go to.)
This code seems to set both the Return-Path and Sender.
However, we want those values to be different.
Is there a value we can use so that when we send the message we can specify the return-path to be one thing and the sender to be another?
We tried this, but it does not work:
BodyMessage.Headers.Add("Sender", "[email protected]");
That code just gets completely ignored.
Any ideas?
For the message-ID we have tried this:
BodyMessage.Headers.Add("Message-ID", "[email protected]");
But, that also gets ignored.
If, however, we specify a custom header value such as "X-Message-ID" then this code works:
BodyMessage.Headers.Add("X-Message-ID", "[email protected]");
But, that is not what we want since we don't want to add an additional email-header item, but rather supply the main message-id header element.
Any help is greatly appreciated.
Thanks in advance!