I can usually send an email. I just can not change DisplayName
.
Follow the code below:
var body = "<p>Email From: {0} ({1})</p><p>Message:</p><p>{2}</p>";
var message = new MailMessage();
message.From.DisplayName = "Nome Nome";
message.To.Add(new MailAddress("[email protected]"));
message.Subject = "Teste Subject";
message.Body = string.Format(body);
message.IsBodyHtml = true;
using (var smtp = new SmtpClient())
{
await smtp.SendMailAsync(message);
}
At line message.From.DisplayName = "Nome Nome";
, how can I change DisplayName
?