I need to send an email in asp.net but I need sender appears like "MySiteName" without [email protected].
For sending email we need a SMTP Server, so in ASP.Net we have the SmtpClient class, using that class object we set its properties for the SMTP settings. SmtpClient client = newSmtpClient("smtp.gmail.com", 587);
Like this:
using(MailMessage message = new MailMessage( new MailAddress("[email protected]", "Your Name"), new MailAddress("[email protected]", "Their Name") )) { message.Subject = ...; message.Body = ...; new SmtpClient().Send(message); }
You will need to enter the SmtpClient
's connection settings in Web.config
you could try something like this
MailAddress from = new MailAddress("[email protected]", "MySiteName");
More info here
http://msdn.microsoft.com/en-us/library/system.net.mail.mailaddress.aspx
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