Rav,
My web.config:
<system.net>
<mailSettings>
<smtp from="
[email protected]" deliveryMethod="Network" >
<network host="localhost" password="" userName="" />
</smtp>
</mailSettings>
</system.net>
</configuration>
<EO defaultConnectionStringName="LocalSqlServer">
<contactForm mailTo="
[email protected]"/>
</EO>
Also, does the click event in your ASPX pagge refer to the same name as in your code-behind file?
My button:
<asp:Button runat="server" ID="txtSubmit" Text="Send" OnClick="txtSubmit_Click" />
My click event in the code-behind:
protected void txtSubmit_Click(object sender, EventArgs e)
{
try
{
// Composed and send a mail
MailMessage msg = new MailMessage();
msg.IsBodyHtml = false;
msg.From = new MailAddress(txtEmail.Text, txtName.Text);
msg.To.Add(new MailAddress(Globals.Settings.ContactForm.MailTo));
if (!string.IsNullOrEmpty(Globals.Settings.ContactFor m.MailCC))
msg.CC.Add(new MailAddress(Globals.Settings.ContactForm.MailCC));
msg.Subject = string.Format(Globals.Settings.ContactForm.MailSub ject, txtSubject.Text);
msg.Body = txtBody.Text;
new SmtpClient().Send(msg);
// Confirm, and empty the page
lblFeedbackOK.Visible = true;
lblFeedbackKO.Visible = false;
txtName.Text = "";
txtEmail.Text = "";
txtSubject.Text = "";
txtBody.Text = "";
}
catch (Exception)
{
lblFeedbackOK.Visible = false;
lblFeedbackKO.Visible = true;
}
}
Could you post both your aspx and code-behind for the contact page? Perhaps that will help us troubleshoot your problem.
Thanks :)
Cheers,
Peter
http://entropia-online.blogspot.com/