Showing posts from May, 2011

Mail This!!!

I am sure many of you might have come across situations where you want to send mail from your application. I will be sharing a bit of code that will help you in this. For sending a mail all we need is a SMTP(Simple Mail Transfer Protocol) Server which we will be getting it for free from GMAIL.( Now to use this server we need credentials to this server. There is no big deal in getting these credentials you only need to have a gmail account.(Which also is free :)) OK now we got all the essential ingredients, lets start coding.... Sending mail is in C# .NET is straight forward.Its all there in System.Net.Mail and System.Net namespaces.Now to connect to a server we need a client object which is instantiated from the  System.Net.Mail.SmtpClient class . To setup the properties of a SMTP client you might want to refer this . SmtpClient  emailClient =  new   SmtpClient ( "" ); The argument passed to the constructor is the SMTP server host