指定"到"在.NET的SMTP邮件设置地址邮件、地址、QUOT、NET

2023-09-06 23:00:11 作者:我没在等

是否有可能将要在SMTP邮件设置地址就像发件人地址?有一个属性从,而不是要的地址。基本上我需要发送电子邮件到技术支持,每当一个特定的异常(或任何未处理的异常)在应用程序中发生的情况。我可以将其添加到的appSettings,但想知道如果我能在SMTP设置本身指定它,而不必从的appSettings阅读。在此先感谢

 < system.net>
    < mailSettings>
      <从=ben@contoso.com&GT SMTP deliveryMethod =网络;
        <网络主机=某些服务器defaultCredentials =真/>
      < / SMTP>
    < / mailSettings>
  < /system.net>
 

解决方案

没有,你不能在指定属性配置文件。您需要将编程设定。

Asp.net中VS2010中为SQLDataSource控件配置数据源,为什么到这一步进行不下去了 求大神解答

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="ben@contoso.com">
        <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.