This project is read-only.

Contact Form problems

Topics: Developer Forum, Localization Forum, Project Management Forum, User Forum
Feb 7, 2010 at 1:33 AM

Does anyone know what this means and how I fix it?



Server Error in '/' Application.

Mailbox name not allowed. The server response was: sorry, your mail was administratively denied. (#5.7.1)

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: Mailbox name not allowed. The server response was: sorry, your mail was administratively denied. (#5.7.1)

Source Error:

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

Source File: d:\hosting\5412965\html\SectionControls\ContactForm.ascx.cs    Line: 107

Stack Trace:

[SmtpException: Mailbox name not allowed. The server response was: sorry, your mail was administratively denied. (#5.7.1)]
   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\5412965\html\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
Feb 22, 2010 at 9:09 PM


The problem for me was that the contact form uses the email address of the person filling out the form as the "From" address to create the MailMessage.  My mail server doesn't like the foriegn address in sending the message, hence the error.  If I used my own address in the form I didn't get the error because it is my mail server settings in the CMS Setup.

The workaround was to change the two lines of code in the contact form that create the MailMessage to use the WebSite setting "MailSenderAddress" for the "From" address.  Presuming that the MailSenderAddress is also from your server.

Hope this helps.

Mar 9, 2010 at 5:50 AM
Edited Mar 9, 2010 at 5:50 AM


Can you elaborate  - what do I need to change in the contactform.cs ?

got the:



string EmailTo

get { return _data.EmailTo; }

set { _data.EmailTo = value; }


Mar 14, 2010 at 5:39 PM


Mar 17, 2010 at 11:07 PM

You might be interested in my custom contact form.


Its set up as an easy module and so can be added into any page quite quickly, you just have to edit the CS code file to set up your SMTP, password, username etc