Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool flag = false;
- var message = new MailMessage();
- try
- {
- message.To.Clear();
- message.To.Add(new MailAddress(to));
- message.From = new MailAddress(from);
- message.Subject = subject;
- message.Body = body;
- message.IsBodyHtml = true;
- using (var smtp = new SmtpClient())
- {
- var credential = new NetworkCredential
- {
- UserName = "Email@mail.com",
- Password = "password"
- };
- smtp.Credentials = credential;
- smtp.Host = "smtp-mail.outlook.com";
- smtp.Port = 587;
- smtp.EnableSsl = true;
- smtp.Send(message);
- }
- flag = true;
- }
- catch (Exception ex)
- {
- }
- return flag;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement