Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
Send EMAIL using C#.net with SMTP
Author:
Manoj Shrivastava
E-mail:
Click to e-mail author
Submitted:
2/23/2009
Version:
C#
Compatibility:
C#
Category:
Views:
11817
Send email using smtp object in C#.net.
Declarations:
using System.Web.Mail;
Code:
protected void SendEMail(string MailTo, string MailFrom, string MailSubject, string MailBody) { MailMessage objEmail = new MailMessage(); objEmail.To = MailTo; objEmail.From = MailFrom; objEmail.Subject = MailSubject; MailBody = MailBody.Replace("\r\n", "
"); MailBody = MailBody.Replace("\t", " "); objEmail.Body = MailBody; objEmail.Priority = MailPriority.High; objEmail.BodyFormat = MailFormat.Html; try { SmtpMail.Send(objEmail); } catch (Exception exc) { Response.Write("Send failure: " + exc.ToString()); } }
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement