SMTP电子邮件格式为全名

时间:2015-01-08 04:29:51

标签: asp.net outlook

我们已经创建了一个asp.net应用程序,现在应用程序使用smtp发送电子邮件,发送电子邮件是可以的,但是当我们收到它时,我们收到它为name.lastname@company.com而不是全名(James Reign) )。请帮帮我,下面是我的代码片段。

<system.net>
<mailSettings>
  <smtp from="lastname@company.com">
    <network defaultCredentials="false" host="server" password="lalala" userName="James.Reign" />
  </smtp>
</mailSettings>


Public Shared Sub SendEmailToITSupport(ByVal sender As String, ByVal receiver As String, ByVal subject As String, ByVal body As String) 
Dim mySMTP As New SmtpClient Dim oMail As New MailMessage(sender, receiver, subject, body) Try If System.Configuration.ConfigurationManager.AppSettings("AllowSendingMail") = 1 Then oMail.IsBodyHtml = True mySMTP.Send(oMail) End If Catch ex As Exception Err.Clear() End Try End Sub 

1 个答案:

答案 0 :(得分:0)

试试这个

CS代码:

using(MailMessage message = new MailMesage(
        new MailAddress("You@Domain.com", "Your Name"),
        new MailAddress("Recipient@OtherDomain.com", "Their Name")
    )) 

OR web.config

<smtp deliveryMethod="Network" from="Mail Displayname &lt;mail@raccoom.net&gt;">