To send Email using Gmail Account

public static bool SendEMail(string to, string from, string subject, string body, string attachments)
        MailMessage mail = new MailMessage();

        //set the addresses
        mail.From = new MailAddress(from);

        //set the content
        mail.Subject = subject;
        mail.Body = body;
        mail.IsBodyHtml = true;
        if (attachments.Length > 0)
            if (System.IO.File.Exists(HttpContext.Current.Server.MapPath(attachments.Trim())))
                mail.Attachments.Add(new     Attachment(HttpContext.Current.Server.MapPath(attachments.Trim())));
        //send the message
        SmtpClient smtp = new SmtpClient();

        //to authenticate we set the username and password properites on the SmtpClient

        SmtpClient client = new SmtpClient("");
        client.Port = 587;
        client.EnableSsl = true;
        NetworkCredential credential = new NetworkCredential("", "xxxxxxxx");
        client.UseDefaultCredentials = false;
        client.Credentials = credential;
        return true;

Related Alrticles

Add Your Business in Free Listing

FREE!!! Registration