Base solution for your next web application
Open Closed

SMTP EmailSender Not Using Default Display Name #8195


User avatar
0
wizgod created

Greetings Programs!

I am using the following to send a message but when I receive the email, it is not using the default display name saved in the SMTP settings.

await _emailSender.SendAsync(new MailMessage
{
	To = { recipient },
	Subject = email.Subject,
	Body = email.Message,
	IsBodyHtml = true
});

The default email in the SMTP settings is set to [email protected] and the default display name is set to Notifications. When I receive emails in my gmail account, it displays as Do-Not-Reply <[email protected]> instead of Notifications which is what I'm expecting.

Thanks,

Wg


4 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    Does this problem exist with other emails? For example Outlook.

  • User Avatar
    0
    wizgod created

    Hi @maliming, it's the same with other email addresses and email clients (Outlook, iPhone Mail)

  • User Avatar
    0
    maliming created
    Support Team

    Does the code below work for you?

    await _emailSender.SendAsync(new MailMessage
    {
        From = new MailAddress(
                "[email protected] ",
                "Notifications",
                Encoding.UTF8
        ),
        To = { recipient },
        Subject = email.Subject,
        Body = email.Message,
        IsBodyHtml = true
    });
    
  • User Avatar
    0
    wizgod created

    Hi @maliming,

    Yes, using that code is bringing in the default display name configured in Settings.

    Thank!

    Wg