Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void WelcomeMail(string recipient)
- {
- MailMessage mailMessage = new MailMessage("MyEmail", recipient);
- StringBuilder sbEmailBody = new StringBuilder();
- sbEmailBody.Append("How can I attach .html file here instead of writing the whole code");
- mailMessage.IsBodyHtml = true;
- mailMessage.Body = sbEmailBody.ToString();
- mailMessage.Subject = "Welcome to domain.com";
- SmtpClient smtpClient = new SmtpClient("smtp.gmail.com", 587);
- smtpClient.Credentials = new System.Net.NetworkCredential()
- {
- UserName = "MyEmail",
- Password = "MyPassword"
- };
- smtpClient.EnableSsl = true;
- smtpClient.Send(mailMessage);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement