Hi to all,
How to send a mail from asp.net application using C#.net
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Posted Aug 7, 2009, 5:19 AM
SmtpClient smtp = new SmtpClient();
smtp.UseDefaultCredentials = true;
MailMessage mailMessage = new MailMessage();
mailMessage.To.Add( new MailAddress( ToemailAdresss,
ToDisplayname);
//create the mail message
mailMessage.Subject = subject;
mailMessage.Body = messageBody;
mailMessage.From = new MailAddress( fromEmailAddress,
fromDisplayName );
smtp.Send( mailMessage );
Deependra KhangarotPosted Aug 6, 2009, 1:42 AM
Niradhip ChakrabortyPosted Aug 4, 2009, 1:56 AM
1. http://www.aspnettutorials.com/tutorials/email/email-auth-aspnet2-csharp.aspx
2. http://www.developer.com/net/asp/article.php/3096831
3. http://www.dotnetspider.com/resources/22633-HOW-TO-SEND-AND-EMAIL-FROM-ASP-NET-APPLICATION.aspx
Roei BarPosted Aug 3, 2009, 2:47 PM
you can use smtpclient,
here is a sample code:
void SendEMail(string from, string to, string subject, string body)
{
try
{ // Construct a new e-mail message
SmtpClient client = new SmtpClient(smtpClient);
client.Send (from, to, subject, body);
}
catch (SmtpException ex)
{
MessageBox.Show ( ex.Message, "SendEMail: " + ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error );
}
}
enjoy