Login
|
Webmail
|
Support
|
480-388-3777
Let's Chat
Infrastructure As A Service (IaaS)
Managed Hosting Overview
High Availability & Load Balancing
Data Storage
Disaster Recovery & Backup
All-In-One/DDOS Attack Protection
Security
Management Services
Email Solutions
Hosted / Encrypted Email
Enterprise / Encrypted Email
Partners Overview
Preferred Partners
Managed Hosting Overview
Managed Servers
Self-Managed Servers
Shared Website Hosting
Hosted / Encrypted Email
Domain Names
Company Overview
Leadership Team
Brinkster News
Careers
Data Center
Network
Legal
Corporate Social Responsibility
Contact Brinkster
Send Email C#.Net\ASP.Net 3.5
Added By:
noidware
Rated:
(3 of 5) by 3.
Thank you for rating this snippet.
Description:
Send e-mail with a basic sub function with C#\ASP.Net 3.5
Language:
C#
Save to web space
E-mail Link
Code Snippet:
using System.Net.Mail; 01. public static void SendEmail(string strMessage, string ToAddress, string FromAddress, string strSubject, MailPriority Priority) 02. { 04. 04. MailMessage m = new MailMessage(); 06. { 06. m.From = new MailAddress(FromAddress); 07. m.To.Add(new MailAddress(ToAddress)); 09. m.Body = strMessage; 10. m.IsBodyHtml = true; 11. m.Subject = strSubject; 12. m.Priority = Priority; 12. //Note you could add a lot more Options and also could add them to the Sub. 15. } 15. 15. System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient(); 17. 17. smtp.Credentials = new System.Net.NetworkCredential(Convert.ToString(FromAddress), "YourPassword"); 23. smtp.Host = "sendmail.brinkster.com"; 23. smtp.Send(m); 23. 23. } //example: SendEmail("
Hello
World
", "Someones@email.com", "Yourdomain@emailaddress.com", "Hello World Test", Net.Mail.MailPriority.High) //Very Basic sendmail, could add more options like I said. Make it into Function to return a false if failed. //Make a class and add this to it. But remember if you use a class on the VB code make sure you Import your class. //This example was used couple of examples in the code bank, but simplicity for novice to understand. //This code will be converted for vb.net users.
Toll free:
1 (800) 345-7084