0
At first: I am sending an email using the standard ASP . NET service as code below
public class SendMail
{
public bool SendEmail(MailModel mail, string subject, string body)
{
try
{
string emailRemetente = System.Configuration.ConfigurationManager.AppSettings["EmailRemetente"].ToString();
string senhaRemetente = System.Configuration.ConfigurationManager.AppSettings["SenhaRemetente"].ToString();
MailMessage message = new MailMessage(emailRemetente, mail.To, subject, body);
Console.WriteLine(message.IsBodyHtml);
message.IsBodyHtml = true;
message.BodyEncoding = UTF8Encoding.UTF8;
SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
client.EnableSsl = true;
client.Timeout = 100000;
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.UseDefaultCredentials = false;
client.Credentials = new NetworkCredential(emailRemetente, senhaRemetente);
client.Send(message);
return true;
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
return false;
}
}
}
where the Mailmodel parameter will be filled as:
public class MailModel
{
public string From { get; set; }
public string To { get; set; }
}
- I want to know how to send email marketing (personalized emails using HTML), I just add a reference to the body?
- Is there any framework or plugin for ASP . NET that does this?
I couldn’t understand exactly what your doubt is
– Leandro Angelo