Use this code...
using System.IO;
using System.Net;
using System.Net.Mail;
using System.Text;
using System.Globalization;
string to = "rajeeshmenoth@wordpress.com";
string from = "rajeeshmenoth@wordpress.com";
MailMessage message = new MailMessage(from, to);
if (fuAttachment.HasFile)
{
string FileName = Path.GetFileName(fuAttachment.PostedFile.FileName);
message .Attachments.Add(new Attachment(fuAttachment.PostedFile.InputStream, FileName));
}
message.Subject = txt_subject.text;
message.Body = mailbody;
message.BodyEncoding = Encoding.UTF8;
message.IsBodyHtml = true;
SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
System.Net.NetworkCredential basicCredential1 = new
System.Net.NetworkCredential("yourmail id", "Password");
client.EnableSsl = true;
client.UseDefaultCredentials = false;
client.Credentials = basicCredential1;
try
{
client.Send(message);
}
catch (Exception ex)
{
throw ex;
}
or
smtpClient.EnableSsl = true;//enable the ssl