How do I change the FROM address to a friendly name?
来源:互联网 发布:大智慧软件官方网 编辑:程序博客网 时间:2024/05/15 16:40
By default, many people set the FROM property of the MailMessage class to something like:
[ C# ]
[ VB.NET ]
mail.From = "me@mycompny.com"By doing this the email address will show up in the FROM line of most email readers, such as Outlook, Outlook Express, or Eudora. To have a friendly name be displayed (instead of the email address), use the following syntax.
mail.From = "/"John Smith/" <me@mycompny.com>"The following code snippet demonstrates this technique.
[ C# ]
MailMessage mail = new MailMessage();mail.To = "me@mycompany.com";mail.From = "/"John Smith/" <you@yourcompany.com>";mail.Subject = "this is a test email.";mail.Body = "this is my test email body.";SmtpMail.SmtpServer = "localhost"; //your real server goes hereSmtpMail.Send( mail );
[ VB.NET ]
Dim mail As New MailMessage()mail.To = "me@mycompany.com"mail.From = """John Smith"" <you@yourcompany.com>"mail.Subject = "this is a test email."mail.Body = "this is my test email body."SmtpMail.SmtpServer = "localhost" 'your real server goes hereSmtpMail.Send(mail)
- How do I change the FROM address to a friendly name?
- FAQ How do I write to the console from a plug-in?
- Ubuntu: How to Change the Computer Name
- From an inner class, "this" points to the inner object. How do I get a "this" pointer to the enclosing object?
- How do I get a MAC address via command line?
- How do I change the default runlevel in Feodra 15?
- How do I set or change the PATH system variable?
- How to change CentOS IP address on a cloned VM
- How do I upload or download XML to/from a database
- How do I add placeholder text from the model into a MVC view?
- pyqt - How to change the color of a word from my textedit
- How do I select a random line from a file?
- How can I get my public IP address from the command line, if I am behind a router?
- How do I perform a manual full refresh instead of using the Apply program to do the full refresh?
- How to change the name of logfile dynamically using log4j
- How do I bind the values of an enum to a ComboBox?
- How do I lock the orientation to portrait mode in a iPhone Web Application?
- How do I add a library project to the Android Studio?
- 一个功能强大的表单验证程序
- SDE CAD Client的入库出错问题
- JavaScript 对象与数组参考大全
- C# - MailSender 邮件发送组件源代码 (支持ESMTP, 附件)
- 基于WEB系统的多语言支持--ASP国际化多语言详细方案
- How do I change the FROM address to a friendly name?
- 我的高级win32API作业(附我的答案)
- 小笨霖英语笔记本(2)
- 怎样可以强行把别人的QQ加为自己的好友
- 调整心态 正面生活
- 怎么在ORCALE9i中建立新的方案
- ASP上传数据流格式分析
- 十四章
- 郁闷.net不会这么惨吧!