Contact Page send email problem

Developer
Aug 22, 2009 at 4:54 PM
Edited Aug 22, 2009 at 4:55 PM

When testing the contact page I receive the following error from the site I set up on webhost4live www.newyorkanticrime.com Does anyone have any idea how I correct this problem?

 

Server Error in '/' Application.
  ------------------------------------------------------------------------


    /Transaction failed. The server response was: Sending address not
    accepted due to spam filter/

* Description: *An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

* Exception Details: *System.Net.Mail.SmtpException: Transaction failed.
The server response was: Sending address not accepted due to spam filter

*Source Error:*

||


Line 105:                }
Line 106:
Line 107:                client.Send(mail);
Line 108:
Line 109:                Session["ContactFormSent"] = true;


* Source File: *
d:\hosting\member\ameloni\site1\SectionControls\ContactForm.ascx.cs*   
Line: * 107

*Stack Trace:*

||


[SmtpException: Transaction failed. The server response was: Sending address not accepted due to spam filter]
   System.Net.Mail.MailCommand.CheckResponse(SmtpStatusCode statusCode, String response) +1061671
   System.Net.Mail.MailCommand.Send(SmtpConnection conn, Byte[] command, String from) +41
   System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, SmtpFailedRecipientException& exception) +101
   System.Net.Mail.SmtpClient.Send(MailMessage message) +1480
   SectionControls_ContactForm.btnSubmit_Click(Object sender, EventArgs e) in d:\hosting\member\ameloni\site1\SectionControls\ContactForm.ascx.cs:107
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565


------------------------------------------------------------------------
*Version Information:* Microsoft .NET Framework Version:2.0.50727.4016;
ASP.NET Version:2.0.50727.4016

Developer
Aug 22, 2009 at 6:05 PM

I contacted webhostforlife and they suggested the following cange and it worked:

SmtpClient smtp = new SmtpClient("mail.domainname.com");

                //to authenticate we set the username and password properites on the SmtpClient
                smtp.Credentials = new NetworkCredential("user@domainename.com", "password");
                smtp.Send(mail);
                //client.Send(mail);

 

what do I need to change to so that  the contact page and other section pass the smtp script they suggest?