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

3 nhận xét:

Unknown on January 31, 2019 at 9:48 PM said...

Read all the information that i've given in above article. It'll give u the whole idea about it.
AWS training in chennai

AWS Training in Bangalore

Keerthana on May 12, 2020 at 1:07 AM said...

Thanks for sharing your valuable post and keep doing Looking towards more

To Enhance and Explore the Technical Knowledge's Learn Python
python training in chennai | python training in annanagar | python training in omr | python training in porur | python training in tambaram | python training in velachery

aarthi on July 23, 2020 at 6:25 AM said...

Great Article… I love to read your articles because your writing style is too good, its is very very helpful for all of us
and I never get bored while reading your article because, they are becomes a more and more interesting from the starting lines until the end.
Java training in Chennai

Java training in Bangalore

Java training in Hyderabad

Java Training in Coimbatore

Java Online Training


 

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