try { //YAHOO SMTP Host (smtp.mail.yahoo.com) //GMAIL SMTP Host (smtp.gmail.com) //WINDOWS LIVE SMTP HOST (smtp.live.com) SmtpClient mySmtpClient = new SmtpClient("smtp.mail.yahoo.com", 25); // set smtp-client with basicAuthentication mySmtpClient.UseDefaultCredentials = false; System.Net.NetworkCredential basicAuthenticationInfo = new System.Net.NetworkCredential("myEmail", "myPassword"); mySmtpClient.Credentials = basicAuthenticationInfo; // add from,to mailaddresses MailAddress from = new MailAddress("From_Email", "Title"); MailAddress to = new MailAddress("To_Email", "Test Email"); MailMessage myMail = new System.Net.Mail.MailMessage(from, to); // set subject and encoding myMail.Subject = Email_Subject; myMail.SubjectEncoding = System.Text.Encoding.UTF8; // set body-message and encoding myMail.Body = Email_Body; myMail.BodyEncoding = System.Text.Encoding.UTF8; // text or html myMail.IsBodyHtml = true; mySmtpClient.Send(myMail); return true; } catch (SmtpException ex) { return false; } catch (Exception ex) { return false; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)