How do I add the Reply-To header to the MailMessage? To add the Reply-To header to an email, you need to use the MailMessage.Headers property. For example:
mail.Headers.Add( "Reply-To", "alternate_email@mycompany.com")
MailMessage mail = new MailMessage(); mail.To = "me@mycompany.com"; mail.From = "you@yourcompany.com"; mail.Subject = "this is a test email."; mail.Body = "this is my test email body."; mail.Headers.Add( "Reply-To", "alternate_email@mycompany.com" ); SmtpMail.SmtpServer = "localhost"; //your real server goes here SmtpMail.Send( mail );
Dim mail As New MailMessage() mail.To = "me@mycompany.com" mail.From = "you@yourcompany.com" mail.Subject = "this is a test email." mail.Body = "this is my test email body." mail.Headers.Add("Reply-To", "alternate_email@mycompany.com") SmtpMail.SmtpServer = "localhost" 'your real server goes here SmtpMail.Send(mail)
Copyright © 2004 Contact: Dave Wanta. aspNetEmail aspNetPOP3 aspNetMime