How do I change the FROM address to a friendly name? By default, many people set the FROM property of the MailMessage class to something like:
mail.From = "me@mycompny.com"
mail.From = "\"John Smith\" <me@mycompny.com>"
MailMessage mail = new MailMessage(); mail.To = "me@mycompany.com"; mail.From = "\"John Smith\" <you@yourcompany.com>"; mail.Subject = "this is a test email."; mail.Body = "this is my test email body."; SmtpMail.SmtpServer = "localhost"; //your real server goes here SmtpMail.Send( mail );
Dim mail As New MailMessage() mail.To = "me@mycompany.com" mail.From = """John Smith"" <you@yourcompany.com>" mail.Subject = "this is a test email." mail.Body = "this is my test email body." SmtpMail.SmtpServer = "localhost" 'your real server goes here SmtpMail.Send(mail)
Copyright © 2004 Contact: Dave Wanta. aspNetEmail aspNetPOP3 aspNetMime