Is it possible to set a "to" attribute in the mailSettings
element in the Web.config file?
No, it isn't
Here is the docs for mailSettings: http://msdn.microsoft.com/en-us/library/w355a94k.aspx
Set the default "to" in an AppSetting instead and use that from you mail sending logic.
This is an example taken from the msdn docs:
<mailSettings>
<smtp deliveryMethod="network" from="[email protected]">
<network
host="localhost"
port="25"
defaultCredentials="true"
/>
</smtp>
</mailSettings>
You can add a Key
<appSettings>
<add key="EmailToAddress" value="[email protected]"/>
</appSettings>
And from your codebehind you can get it like this
var toAddress= ConfigurationManager.AppSettings["EmailToAddress"];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With