www.Bagal.Org
TagCloud
Finally.... I did it

I am using My Web Pages Starter Kit for designing this site & I have hosted this site at GoDaddy . When I use contact form control on page sometimes it was throwing runtime dotnet exception

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

Then I realized  whenever I use E-Mail Address field as something@yahoo.com or something@gmail.com then godaddy relay server relay-hosting.secureserver.net  gives exception “Mailbox name not allowed” . This form works fine when I enter my email address as myname@bagal.org

So I concluded this contact form try to send me email when someone feels contact form & gives from email ID as the email ID entered on UI. Mail server relay do not allow to do this .

So I did a trick in my code

I changed code to on \ SectionControls\ ContactForm.ascx.cs

Line reads something as

 mail = new MailMessage(new MailAddress(txtEmailFrom.Text.Trim(),txtName.Text.Trim() ), new MailAddress(_section.EmailTo,_section.EmailTo));

Which I changed to

 mail = new MailMessage(new MailAddress("spam@bagal.org",txtName.Text.Trim() + " " + txtEmailFrom.Text.Trim()), new MailAddress(_section.EmailTo,_section.EmailTo));

this means I always get email from my dummy email ID spam@bagal.org & email ID filled in form in name field of email .

This solved the contact form issue in MWPSK for me.  I would like to suggest this trick to MWPSK to make this field configurable in their next version.

Till then if you face similar issue , try to use my trick.

No Comments

Title
Author
Comment
Anti Bot Image   
  
Rss