本文共 837 字,大约阅读时间需要 2 分钟。
来自:http://outofmemory.cn/code-snippet/1638/c-fayoujian-display-youhao-fajianren-method
发件人可以设置为\Webtips Emailer\ 格式,这样在收件人看到的邮件就可以看Webtips Emailer的友好用户名了。
代码如下:
//Creating new mail message System.Web.Mail.MailMessage MyMail = new System.Web.Mail.MailMessage(); //Display Name can be sent using following format //\<>\ " MyMail.From = @"\Webtips Emailer\ "; //To Address MyMail.To = "webtips.co.in@gmail.com"; // BCC Address MyMail.Bcc = "somename@someserver.com"; //Mail Subject MyMail.Subject = "Subject Of the mail"; //Body of the mail MyMail.Body = "test mail message"; MyMail.BodyFormat = System.Web.Mail.MailFormat.Html; //SMTP Server name or IP from which mail to be sent System.Web.Mail.SmtpMail.SmtpServer = "smtp.someserver.com"; //Sending Mail System.Web.Mail.SmtpMail.Send(MyMail);
转载地址:http://hrunb.baihongyu.com/