2008-10-31 41 views

回答

53

那麼,在代碼中,您需要將發件人的名稱放在引號中,後面跟着電子郵件地址。

new SmtpClient(...).Send("\"John Smith\" [email protected]", ...); 

而且......它看起來像你可以編碼成太屬性...

<smtp from="&quot;John Smith&quot; &lt;[email protected]&gt;"> 
+1

我設置認爲你也可以在發件人的名字後面加上括號:「[email protected](John Smith)」 – cfeduke 2008-10-31 02:45:43

+4

括號方法是有效的,並在RFC中標記爲「遺留」方法http://tools.ietf .org/html/rfc2822#page-16但是「d isplay name「方法推薦。 – 2008-10-31 03:07:00

-3
<system.net> 
<mailSettings> 
<smtp from ="XYZ&lt;[email protected]&gt;"> 
<network host="smtp.gmail.com" port="25" userName="[email protected]" password="******" enableSsl="true"/> 
</smtp> 
</mailSettings> 
</system.net> 

1)請使用這些在app.config文件

相關問題