C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Sending mail using gmail smtp server


Posted Date: 08 May 2008    Resource Type: Code Snippets    Category: ASP.NET WebForms

Posted By: mani       Member Level: Silver
Rating:     Points: 7



hi

by using this code we can send the mail using the gmail smtp server
and this is is very useful if we don't know the name of the smtp server

thank you


MailMessage obj1 = new MailMessage();

obj1.From = "*****@gmail.com";
obj1.To = "*****@gmail.com";
obj1.Subject =txtFrom.Text +" is the sender "+ txtSubject.Text;
obj1.BodyFormat = MailFormat.Html;
obj1.Body = FreeTextBox2.Text;
SmtpMail.SmtpServer = "smtp.gmail.com";
obj1.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
obj1.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "******@gmail.com");
obj1.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "********");
obj1.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", "465");
obj1.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusessl", "true");
SmtpMail.Send(obj1);





Responses


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

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

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: Creating and Executing Batch Files Progrmatically using C#
Previous Resource: Creating server control at runtime
Return to Discussion Resource Index
Post New Resource
Category: ASP.NET WebForms


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

conference calls

Contact Us    Privacy Policy    Terms Of Use