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 » ASP.NET WebForms »

Send email from gmail account in asp.net


Posted Date: 29 Oct 2009    Resource Type: Code Snippets    Category: ASP.NET WebForms
Author: Nikhil GaurMember Level: Diamond    
Rating: 1 out of 5Points: 10



If you want to send email from your asp.net application and you don't have any smtp server then use your gmail account to send email from your application

I searched a lot on internet but no code was in running condition. then i took a code and modified it and I was successful. that i am providing here.

here is the simple code to do this


private void SendMail(string verify, string Reciever)
{
MailMessage mail = new MailMessage("yourusername@gmail.com", Reciever);
mail.Subject = "Testing";

string Body = "This is a testing mail";
mail.Body = Body;

mail.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com"; //gmail SMTP Server Address
smtp.Port = 587;//port number
smtp.Credentials = new System.Net.NetworkCredential("yourusername@gmail.com", "your password");
//Or your Smtp Email ID and Password
smtp.EnableSsl = true;
smtp.Send(mail);
}



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  .  Google  .  Gmail  .  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: Dealing with Detailsview control through coding
Previous Resource: Creating Image from String
Return to Discussion Resource Index
Post New Resource
Category: ASP.NET WebForms


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use