Reply-To header to the MailMessage in .Net framework 1.1

.Net framework 2.0 upper version already has supported ReplyTo property for MailMessage class. But how to set this header to your MailMessage in .Net 1.1, here is what i found, hope it useful for you ^^.

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")
The following code snippet demonstrates this technique.


[ C# ]
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 );

[ VB.NET ]
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)

From www.systemwebmail.com FAQ

1 nhận xét:

Jagna Co Kalani on December 12, 2017 at 12:55 AM said...

Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a .Net developer learn from Dot Net Training in Chennai. or learn thru ASP.NET Essential Training Online . Nowadays Dot Net has tons of job opportunities on various vertical industry.
or Javascript Training in Chennai. Nowadays JavaScript has tons of job opportunities on various vertical industry.

 

Coding experience share Copyright © 2010 | Designed by Ipietoon for Free Blogger Template