I am having problems with my asp.net application i can run the program with no errors when i fill in the boxes on the contact us section i then get a error saying.
SMTPException was unhanded by user code
Here is my code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Mail;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class contactUs : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void submitform(object sender, EventArgs e)
{
MailMessage email = new MailMessage()
{
Subject = "Email From CraigavonAquatics Contact Us Section",
Body = commentBox.Text,
IsBodyHtml = false,
From = new MailAddress(emailBox.Text, nameBox.Text)
};
email.To.Add(new MailAddress("craigavonaquatics@gmail.com", "Philip Harrison"));
SmtpClient server = new SmtpClient();
server.Send(email);
msgSuccess.Visible = true;
}