设置MAILMESSAGE的发件人名称 [英] MailMessage setting the Senders Name

查看:381
本文介绍了设置MAILMESSAGE的发件人名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以设置从一个名MAILMESSAGE对象?我试图从MailAddress设置,但DisplayName属性似乎是只读的。



我试过我的名字作为发件人和不似乎工作的。


解决方案

 邮件MAILMESSAGE新= MAILMESSAGE(); 
mail.From =新的MailAddress(nerfDeathKnights@mycompany.com,鲍勃·琼斯);


Is it possible to set the from name on a MailMessage object? I tried setting it from MailAddress, but the DisplayName property seems to be read only.

I tried "My Name " as the sender and dont seem to work either.

解决方案

MailMessage mail = new MailMessage();
mail.From = new MailAddress("nerfDeathKnights@mycompany.com", "Bob Jones" );

这篇关于设置MAILMESSAGE的发件人名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆