tags:

views:

73

answers:

2

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

+2  A: 

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]"

il_guru
Iv tried this, and iv monitored the stream thats sent to the server via WireShark, and its still using the Envelope's from address as the FROM address for the SMTP.
pzycoman
A: 

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

dave wanta
Is it possible with AspNetEmail?
pzycoman
Yes. On the aspNetEmail.EmailMessage object, the value of the .ReversePath property is used during the SMTP session (envelope-from), and the .FromAddress property value is used in the actual email message. If you do not set the .ReversePath property, the .FromAddress value is used during the SMTP session.
dave wanta