hostgatorでdotnetnukeモジュールを作成してメールを送信しようとしていますが、メールが機能しません。役立つ提案があれば教えてください。
protected void btnSubmit_Click(object sender, EventArgs e)
{
string Fname = txtFname.Text;
string Lname = txtLname.Text;
string Email = txtEmail.Text;
string Telephone = txtTelephone.Text;
string comments = txtComments.Text;
MailMessage newmail = new MailMessage(ConfigurationManager.AppSettings["FromEmailHelpForm"].ToString(), ConfigurationManager.AppSettings["ToEmailHelpForm"].ToString());
newmail.Subject = "Contact Form Notification";
newmail.IsBodyHtml = true;
newmail.Body = "<table><tr><td>First Name:<td><td>' " + Fname + " '</td><tr><tr><td>Last Name:<td><td>' " + Lname + " '</td><tr><tr><td>Primary Email Address: <td><td>' " + Email + " '</td><tr><tr><td>Telephone: <td><td>' " + Telephone + " '</td><tr><tr><td>Comments: <td><td>' " + comments + " '</td><tr></table>";
SmtpClient mail = new SmtpClient("localhost");
try
{
if (CaptchaControl1.IsValid)
{
mail.Send(newmail);
reset();
pnlMessage.Visible = true;
pnlform.Visible = false;
lblError.Text = "Thankyou for submiting the form we will get you soon";
lblError.ForeColor = System.Drawing.Color.Blue;
}
else
{
lblError.Text = "Invalid Security Code ";
lblError.ForeColor = System.Drawing.Color.Red;
}
}
catch (Exception err)
{
lblError.Text = "An error Occured -->"+err.Message;
lblError.ForeColor = System.Drawing.Color.Red;
}
}
public void reset()
{
txtFname.Text = "";
txtLname.Text = "";
txtTelephone.Text = "";
txtEmail.Text = "";
txtComments.Text = "";
}
}