.Net Mail Application Settings

  Print

Here are the settings that need to go into the web config file of your .NET application:

<system.net>

You may also use these settings in your Form posts when setting up an email system in C# or VB.NET code behind files.

Another way to use .Net mail class:

string ourEmail = ConfigurationManager.AppSettings["OurEmail"].ToString();
MailMessage mail = new MailMessage();
mail.IsBodyHtml = false;
mail.To.Add(new MailAddress(ourEmail));
mail.From = new MailAddress(ourEmail);
mail.Priority = MailPriority.High;
mail.Subject = "Message from mydomain.com";
mail.Body = txtEmail.Text;
SmtpClient smtp = new SmtpClient(ConfigurationManager.AppSettings["SMTPServer"].ToString());

smtp.UseDefaultCredentials = false;
smtp.Credentials = new System.Net.NetworkCredential(ourEmail, ConfigurationManager.AppSettings["OurEmailPass"].ToString());

smtp.Send(mail);
lblConfirm.Text = "Message sent";
btnSubmit.Enabled = false;


Web Config Settings:






Did you find this article useful?   0 out of 0 people found this article useful.

Related Articles

Login

 
Forgot password?
Register now

Language