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 smtpClient


Posted Date: 17 Jun 2009    Resource Type: Code Snippets    Category: Email
Author: Shunmuganathan MMember Level: Diamond    
Rating: 1 out of 5Points: 7



We can send the email using the smtpclient.
The following code will explain how to send the email using smtpclient

Following namespace is used to send email
using System.Net.Mail;



MailMessage MyMailMessage = new MailMessage();
MyMailMessage.Subject = "My Subject";
MyMailMessage.To.Add("To Address ");
MyMailMessage.From = new System.Net.Mail.MailAddress("My From AddressP".Replace("[",
"<").Replace("]", ">"));
Message.Body = " Email Body Content";

SmtpClient MySmtpClient = new SmtpClient("MailServer", 25);
MySmtpClient.Send(Message);




Code Explanation

1. Create the instance of "MailMessage".
2. Fill the properties.
3. Create instance of SmtpClient for the mail server.
4. Send the "MailMessage" through "SmtpClient".


By
Nathan



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 using smtp object in c#
Previous Resource: Sending Emails from Google Server
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