Search code examples
c#.netemailwebmail

C# Webmail.Send method how to change person name


 WebMail.SmtpServer = SmtpServer;
                WebMail.UserName = SmtpUsername;
                WebMail.Password = SmtpPassword;
                WebMail.Send(
                        ReplayEmail,
                        subject,
                        body,
                        email
                    );

subject is for example "Ask specialist"

body is html body

email is for example "[email protected]"

email is send to for example "[email protected]"

now when i send mail i get mail which is ok but as person who send mail I see "[email protected]". how to change this?

mail now looks like

[email protected] Ask specialist

i want name (Adoo for example) and mail like

Adoo Ask specialist


Solution

  • If I understand correctly, when setting up mail you can do :

    mail.To = new MailAddress("[email protected]", "Adoo");
    

    or :

    mail.To= @"\Adoo \ <[email protected]>";