开发者

From column when sending email

开发者 https://www.devze.com 2023-02-04 11:57 出处:网络
The answer should be easy, but I couldn\'t fine. I am sending email in asp.net using c#. I want to change the From part of the email to something meaningful i开发者_StackOverflow社区nstead of the ema

The answer should be easy, but I couldn't fine.

I am sending email in asp.net using c#. I want to change the From part of the email to something meaningful i开发者_StackOverflow社区nstead of the email address. For example instead of 123@website.com I want the user to see website.com support team.

MailMessage message = new MailMessage();                    
message.From = new MailAddress("support@website.com");                   
message.To.Add(new MailAddress(this.txtEmail.Text));
message.Subject = "Welcome to Website";


message.From = new MailAddress("support@website.com", "website.com support team");

http://msdn.microsoft.com/en-us/library/1s17zfkf.aspx


You can also try this:

message.From = new MailAddress("Support Team support@website.com"); 

Everything that is before space will be treated as description, and after last space will be address. It also works with To property.

0

精彩评论

暂无评论...
验证码 换一张
取 消