问题描述
是否有可能将要在SMTP邮件设置地址就像发件人地址?有一个属性从,而不是要的地址。基本上我需要发送电子邮件到技术支持,每当一个特定的异常(或任何未处理的异常)在应用程序中发生的情况。我可以将其添加到的appSettings,但想知道如果我能在SMTP设置本身指定它,而不必从的appSettings阅读。在此先感谢
< system.net>
< mailSettings>
<从[email protected]&GT SMTP deliveryMethod =网络;
<网络主机=某些服务器defaultCredentials =真/>
< / SMTP>
< / mailSettings>
< /system.net>
没有,你不能在指定
属性配置文件。您需要将编程设定。
Is it possible to set "To" address in SMTP mail settings just like "From" address? there is an attribute for "From", but not "To" address. basically I need to send an email to technical support whenever a specific exception (or any unhandled exception) happens in the application. I can add it to "appSettings", but wondering if I can specify it in SMTP settings itself, without having to read from "appSettings". thanks in advance
<system.net>
<mailSettings>
<smtp deliveryMethod="network" from="[email protected]">
<network host="some server" defaultCredentials="true" />
</smtp>
</mailSettings>
</system.net>
No, you cannot specify the To
property in the config file. You will need to set it programatically.
这篇关于指定&QUOT;到&QUOT;在.NET的SMTP邮件设置地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!