Web Wiz
  Knowledgebase Knowledgebase      Customer Login Customer Login

EmailSending Mail Using ASP.NET


Below you will find an example of sending email from your Web Wiz Hosted Website using ASP.NET.



In order to send email you will first need to Setup a Mailbox from your Hosting Control Panel to use to send your email.

You would then enter the email address for your mailbox where it has "you@your-email-here.com" and the password where it has "YourPasswordHere" in the example below.


MailMessage objEmail = new MailMessage();

objEmail.From = new MailAddress("you@your-email-here.com");
objEmail.To.Add("to@to-email-here.com");

objEmail.Subject = "SUBJECT: Test mail from WebWiz";
objEmail.Body = "BODY: Text for body";

SmtpClient mail = new SmtpClient();

mail.EnableSsl = false;
mail.DeliveryMethod = SmtpDeliveryMethod.Network;

mail.Timeout = 20000;

// Must be set BEFORE .Credentials!
mail.UseDefaultCredentials = false;

mail.Credentials = new NetworkCredential("you@your-email-here.com", "YourPasswordHere");

mail.Host = "smtp.WebSiteLive.net";
mail.Port = 587;

mail.Send(objEmail);


Please note that depending on the version of ASP.NET that you have set for your website and the pipeline type you may need to Change ASP.NET to Full Trust in order for the above code to function correctly.



Back To Hosting Knowledgebase Menu


Become a Fan on Facebook Follow us on Twitter Find us on Google+ Community Forums Web Wiz Blogs Web Wiz News
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Policy

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 5977755. Registered in England and Wales.
Registered office: Unit B10, 9 Nimrod Way, East Dorset Trade Park, Wimborne, Dorset, BH21 7UH, United Kingdom.

Prices exclude VAT unless otherwise stated. VAT No. 988999105 - $, € prices shown as a guideline only.


Copyright ©2001-2016 Web Wiz Ltd. All rights reserved.