Currently I have:
<system.net>
<mailSettings>
<smtp from="[email protected]">
<network
host="localhost"
port="25"
/>
</smtp>
</mailSettings>
</system.net>
How can I change it so the email is sent with a name and not the email address only?
Well, in code you need to put the sender's name in quotes, followed by the e-mail address.
new SmtpClient(...).Send("\"John Smith\" [email protected]", ...);
And...it looks like you can encode it into the attribute too...
<smtp from=""John Smith" <[email protected]>">
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