How to set "from" when sendin email via smtp server with using microsoft c#
if you look this image you will understand what i mean
i use the code below for sending emails

MailMessage mail = new MailMessage();
                  开发者_开发知识库  mail.To.Add(srUserEmail);
                    string srBody = "bla bla bla";
 mail.From = new MailAddress("PokemonCraft.Announcement@pokemoncraft.com");
                        mail.Subject = "bla bla bla";
     mail.Body = srBody;
                    mail.IsBodyHtml = true;
                    SmtpClient smtp = new SmtpClient();
                    smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
                    smtp.UseDefaultCredentials = true;
                    smtp.Host = "xxx.xx.xx.xx";
                    smtp.Port = xxx;
                    smtp.Send(mail);
Pass a second argument to the MailAddress constructor:
mail.From = new MailAddress("Announcement@pokemoncraft.com", "Some Display Name")
Format your email address like this:
mail.From = new MailAddress("PokemonCraft <PokemonCraft.Announcement@pokemoncraft.com>");
The MailAddress object should recognize that the part inside <> tags is an email address, whereas the part preceding that is the name of the person or business sending the email.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论