Portal Home > Knowledgebase > Email > Using .NET 2.0 to send an email


Using .NET 2.0 to send an email




Here is some code that will accomplish this:

using System.Net.Mail;

System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage();
msg.To.Add("test@your_domain.com");
msg.From = new MailAddress("test@your_domain.com", "Your Domain",
System.Text.Encoding.UTF8);
msg.Subject = "Test mail using .net2.0";
msg.SubjectEncoding = System.Text.Encoding.UTF8;
msg.Body = "This is my msg Body";
msg.BodyEncoding = System.Text.Encoding.UTF8;
msg.IsBodyHtml = false;
msg.Priority = MailPriority.High;

SmtpClient client = new SmtpClient();
client.Host = "smtpmailer.hostek.net";

client.Send(msg);

 



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
Spam (unsolicited email) (Views: 1556)

* ASP is only available on Windows

Home Page
About
Web Hosting
FAQ
Get Support
Script Downloads

Coldfusion Hosting
ASP Hosting
Linux Hosting
Railo Hosting

Terms of Service
Privacy Policy
Affiliate Program

* ASP is only available on Windows.