C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » Email »

Send email using smtp object in c#


Posted Date: 15 Jun 2009    Resource Type: Code Snippets    Category: Email
Author: Nikhil GaurMember Level: Diamond    
Rating: 1 out of 5Points: 10 (Rs 5)



This is a sample code to send mail through any c# application.


using System.Web.Mail;

protected void SendEMail(string MailTo, string MailFrom, string MailSubject, string MailBody)
{
MailMessage objEmail = new MailMessage();
objEmail.To = MailTo;
objEmail.From = MailFrom;
objEmail.Subject = MailSubject;
MailBody = MailBody.Replace("\r\n", "
");
MailBody = MailBody.Replace("\t", " ");
objEmail.Body = MailBody;
objEmail.Priority = MailPriority.High;
objEmail.BodyFormat = MailFormat.Html;

try
{
SmtpMail.Send(objEmail);
}
catch (Exception exc)
{
Response.Write("Send failure: " + exc.ToString());
}
}




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
Email  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Send Email From C#
Previous Resource: Send Email using smtpClient
Return to Discussion Resource Index
Post New Resource
Category: Email


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use