I looking to change the display name in a Email using MVCMailer. Instead of the client seeing From: custmerservice@xyzCompany.com they will see "xyzCompany Customer Service". I have looked all around the internet and can not find any documentation that explains how.
USERMAILER.CS
public virtual MvcMailMessage Welcome(string sentTo, string replyTo)
{
return Populate(x =>
{
x.Subject = "Welcome";
x.ViewName = "Welcome"; //View name of email going out.
x.ReplyToList.Clear();
x.ReplyToList.Add(replyTo);
x.To.Add(sentTo);
x.From.DisplayName("xyz Company Customer Service");
x.From = new MailAddress("customerservice@xyzCompany.com");
x.ViewName = "WelcomeEmail"; //View name of email going out.
});
}
The line 'x.From.DisplayName("xyz Company Customer Service")' gives me an error: system.net.mail.mailaddress.DisplayName can not be used as a method.
Can anyone please tell me how to properly change the displayname?