The following C# source code shows how to send an email from a Gmail address using the SMTP server.
using System.Net.Mail; MailMessage objeto_mail = new MailMessage(); SmtpClient client = new SmtpClient(); client.Port = 587; client.Host = "smtp.gmail.com"; client.EnableSsl = true; client.Timeout = 10000; client.DeliveryMethod = SmtpDeliveryMethod.Network; client.UseDefaultCredentials = false; client.Credentials = new System.Net.NetworkCredential("username", "password"); objeto_mail.From = new MailAddress("firstname.lastname@example.org"); objeto_mail.To.Add(new MailAddress("email@example.com")); objeto_mail.Subject = "Subject here"; objeto_mail.Body = "Message here"; client.Send(objeto_mail);
Greetings! Very helpful advice in this particular article! It is the little changes that make the most important changes. Thanks for sharing!
I was extremely pleased to discover this great site. I want to to thank you for ones time just for this wonderful read!! I definitely liked every little bit of it and i also have you bookmarked to look at new information in your blog.