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
Toproperty in the config file. You will need to set it programatically.