As it says in the title, I wish to change the FROM address provided to the SMTP server, as opposed to the FROM address in the email envelope.
The closest sample I can find is from Java, which is can be found here
Thanks
As it says in the title, I wish to change the FROM address provided to the SMTP server, as opposed to the FROM address in the email envelope.
The closest sample I can find is from Java, which is can be found here
Thanks
The FROM provided to the SMTP server is the login of the SmtpClient while the one in the Mail is the FROM in the MailMessage.
SmtpClient smtp = new SmtpClient();
smtp.Host = myserver.address.com
smtp.Credentials = new NetworkCredential("[email protected]", "myPassword");
MailMessage msg = new MailMessage();
msg.From = "[email protected]";
//OTHER MESSAGE SETTINGS
smtp.Send(msg);
This should send an e-mail from "[email protected]" using the authentication on the server for the user "[email protected]"
Hi,
Bottom line is, you can't do this. The FROM address used in System.Net.Mail is used for both the SMTP transaction (Envelope-From) and the MailMessage from header value.
Sorry,
Dave