C# Mail Client & Sending Mail With C# .NET
Programming April 17th, 2007As I mentioned below, the first small tutorial will be about writing a small mail client (smtp client). Before starting to tutorial, you have to design a simple GUI (graphical user interface) like below screen shot, a simple interface is enough. In this mail client we will use System.Net.Mail library to create mail and smtp client objects. Our code will be similar to below code piece,
MailMessage mymes = new MailMessage();
mymes.To.Add(new MailAddress(toTextBox.text);
mymes.From=new MailAddress(fromTextBox.text);
mymes.Subject=subjectTextBox.text;
mymes.Body=bodyTextBox.text;
SmtpClient myclient = new SmtpClient(”smtp server host address as string”);
myclient.Send(mymes);
It is easy as it is. It is extremely short and easy to understand (8 lines as you see), the complexity may emerge, if the smtp server needs authorization and maybe it need a ssl connection to authorize username & password (credentials). I leave those to ones who are interested in more than a simple stmp client, if you have any question or help please leave a comment.
An example GUI:

Some other posts that you may like :
Google Chrome Beta is out ! Download it nowASP.NET Url Rewrite - ASP.NET/IIS VS PHP/Apache
Nokia E65 - A swiss knife
Nvidia is now the leader in Desktop Graphics Market, ATI goes down !
Gmail : New big attachment size !
Linutop
Starcraft Proxy Problem
Some funny and weird photos
AnonyMailer / Smtp Client / Tiny Mailer
Get Mac

























































Recent Comments