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 »

Mail sending in asp.net


Posted Date: 02 Oct 2009    Resource Type: Code Snippets    Category: Email
Author: Ashish LanghnojaMember Level: Bronze    
Rating: 1 out of 5Points: 3




using System.Net.Mail;
protected void Mailsend()
{
string Message = "";
try
{
//email setup
string smtpHost = "";
string smtpPort = "";
MailMessage ObjMail = new MailMessage();
SmtpClient ObjSmtpClient = new SmtpClient();
System.Net.NetworkCredential BasicAuthenticationInfo = new System.Net.NetworkCredential();


//Mail settings
ObjMail.From = new MailAddress("from@sample.com");
ObjMail.To.Add("Recever@sample.com");
ObjMail.Subject = "sample";
Message = "sample";
ObjMail.Body = Message;
ObjMail.IsBodyHtml = true;

//SMTP settings
smtpHost = System.Configuration.ConfigurationSettings.AppSettings["smtpHost"].ToString();
smtpPort = System.Configuration.ConfigurationSettings.AppSettings["smtpPort"].ToString();
ObjSmtpClient = new SmtpClient(smtpHost, Convert.ToInt16(smtpPort));
ObjSmtpClient.UseDefaultCredentials = false;
BasicAuthenticationInfo = new System.Net.NetworkCredential("", "");
ObjSmtpClient.Credentials = BasicAuthenticationInfo;
ObjSmtpClient.Send(ObjMail);


}
}
catch
{

}
}



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.
SMTP mail  .  

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: Code to send email
Previous Resource: How to send emails through Asp.Net?
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