In settings email works, but on the contact page nothing happens...

Topics: ASP.NET 2.0, Business Logic Layer, Controls
Feb 26, 2010 at 6:17 AM
Edited Feb 26, 2010 at 6:18 AM

In my settings panel, when i click "Test mail settings" i get the message "Test Successful" and the email shows up in my email account.  For some reason, when I save this and try to send an email through my contact page i get nothing.  No errors displayed, no email in my inbox, nothing.  You can see what i'm talking about here if you are interested.

If it's working in my settings page why wouldn't it send email on my contact page?

Feb 26, 2010 at 7:01 AM

It looks like there's some bad or garbage character(s) in the blog.js file in the root of your site.  If you have Firefox, and navigate to the following URL:

You'll see a bunch of strange characters at the very end of the page/file.

Because of these characters, there's a JavaScript error occurring when trying to Send the contact message.  If the Contact page actually sends an email, the Contact form will get replaced with a message that says "Thank you - The message was sent".

I would make sure the blog.js file in the root of your blog hasn't been modified.  For BE 1.5 (the version you have), the file size for blog.js should be 19,167 bytes.

There's also a known issue in BE 1.5 with the Contact page that could cause an email to not get sent out.  In contact.aspx.cs (in the root of your blog), you'll find this line of code in there:

mail.Sender = mail.ReplyTo;

Delete or comment out that line.

However, in this case, that line of code doesn't seem to be the problem (at least not right now).  Fixing the garbage characters showing up in blog.js is the bigger issue right now.

Feb 27, 2010 at 12:36 AM

Thanks for the heads up Ben.  I had a similar problem on another page that I fixed by removing those characters.  I've removed them from the javascript you mentioned but it's still not working.  Do you think I need to comment out the mail.Sender = mail.ReplyTo?

Feb 27, 2010 at 1:05 AM

Looks like the JavaScript problem is fixed -- that's good.

If when clicking "Send", you get the "Thank you - The message was sent" confirmation, but you're still not getting the actual email, then yes, I would definitely comment out that line of code.  It's completely useless.  BE 1.6 also doesn't have that line of code.

Feb 28, 2010 at 4:47 PM

I went into the code and commented out that line, recompiled and uploaded the binary but I'm still not getting the email for some reason.  Any other ideas, or will I just need to start digging through the code on this one?

Feb 28, 2010 at 6:17 PM

When changing a file like contact.aspx.cs, it isn't necessary to recompile anything.  Only if you were to make a change in the BE core would a re-compile be needed.

You could try also commenting out the line below to see if it makes a difference.

mail.ReplyTo = new MailAddress(email, name);

Otherwise, the email sending code in contact.aspx.cs, and the "test email" code in admin\Pages\Settings.aspx.cs is basically the same in terms of what properties and settings get applied.

Mar 2, 2010 at 3:44 AM

You're than man Ben.  Thanks for the help!!!