开发者

Why there is "from" attribute of <smtp> element in <system.net><mailSettings>? How can i use it?

Why there is "from" attribute of <smtp> element in <system.net><mailSettings>? How can i use it? As far开发者_如何学C as i see, i anyway have to specify From parameter for MailMessage class constructor. Can i use "from" attribute of <smtp> element for this in any natural way?


There is an overload of the MailMessage constructor that doesn't require any parameters. This will set the From property to the value in your .config file. See here for more information, particularly the "Remarks" section:

http://msdn.microsoft.com/en-us/library/ms144707.aspx

"From is set to the value in the network element for mailSettings Element (Network Settings), if it exists."

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜