Mambo and "sex"

Recently, I had trouble with the Mambo [http://mambo-foundation.org/] contact component. Sometimes, the emails would get through, and other times they would not. There did not appear to be any discernable pattern. In the end, I discovered that an innocent looking word in the subject of the email was causing the message to be blocked by some spam filters.

If you are having a similar problem, then it probably means that Mambo is working, but the emails are being blocked further down the line. In order to confirm this, you should test on different servers, and then check if something in the content is being blocked.

Is Mambo Working?

To test on a different server, try setting the receiver to an email address that does not block or delete spam. GMail is good for this. In general, Google does not block or delete spam, it just moves it into the spam folder.

To change the receiver email address, log into the back-end, and click on Components->Contacts->Manage Contacts, then click on the contact, and then changing the "E-mail" setting. If you do this and receive both the original email and the copy, then you know that Mambo is working and the problem lies elsewhere.

If you do not receive both emails, then the problem is probably closer to home. The outgoing email might be blocked by the hosting server. The hosting server might be blocking access to services like SMTP, sendmail or PHP mail, or the Mambo settings may be wrong.

If you think there is a server configuration error, you will need to contact your hosting service or your server administrator and have them look at the problem.

Is Mambo configured properly?

If you think the Mambo settings might be wrong, you need to check these things:

First, log in to the back-end and click on Site->Global Configuration. Then, click on the Server tab and check the "Live Site" value. Does it look right? Write it down.

Next, click on the Mail tab. Check the values here. Are you sure all of the settings are correct for the type of "Mailer" that you have chosen? You may need to test these outside of Mambo and confirm that they work. If you need help, you should contact your hosting service or server administrator.

Even if the settings are correct, there could still be a problem. Is the domain name in the "Mail From" field exactly the same as the domain name of the "Live Site" value you wrote down? If you are using SMTP, is the "SMTP User" the same as the "Mail From". Any differences in these settings might cause a spam filter to reject the email. The filter might see that the email is coming from one IP address, but a reverse DNS lookup on the Return-Path or Reply-To points to a different IP address.

The same problem could arise because of the Contact settings. To check this, close the Global Configurations, and click on Components->Contacts->Manage Contacts. Then click on the contact you are testing. Check the "Name" and "E-mail". Do the email addresses, name and domain match the settings above?

Is the email getting blocked by a spam filter?

If you do receive both emails when you send it to your test server, then Mambo is working fine, and the emails are getting blocked somewhere else. There are two things that might cause an email to be blocked by a spam filter:

  1. Certain words in the subject and body of the email
  2. Suspicious information in the headers of the email

Is the email content being blocked?

Sometimes certain words in an email will be taken out of context and flagged by a spam filter. For instance, these innocent phrases: Middlesex, cock-a-doodle-do, chicken breasts and thighs. You need to check if any words or phrases in the email are being misunderstood. The emails from the contact form pull their information from several different places. You need to check all of these.

First, log in to the back-end and click on Site->Global Configuration. Click on the Site tab and check the "Site Name". Does it contain any words that could be misconstrued? Next, click on the Server tab and check the "Live Site" value. That's correct, the actual domain name could be causing a problem. Then, click on the Mail tab, and check the "Mail From" and "From Name".

While you are in the Global Configuration, click on the on the Locale tab and make a note of the "Language". In my case, this was set to "english".

Next, close the Global Configurations, and click on Components->Contacts->Manage Contacts. Then click on the contact you are testing. Check the "Name" and "E-mail". Could either of those be mistaken as offensive?

If all of those look good, you need to check a few locale constants. Go to your source files and open the language file that corresponds to the "Language" that you noted earlier. For instance, I opened "languages/english.php".

Once you have the file open check these constants _ENQUIRY, _ENQUIRY_TEXT, _COPY_TEXT, _COPY_SUBJECT. Are those all clean?

Last, you need to think about what is being put into the form. Are the words, phrases and email addresses you use when you test the form all clean? On the site that I was having trouble with, the subject of my email included the name of my client "Middlesex County Chamber of Commerce" and this was being flagged by the spam filter because it included the word "sex".

If you run into a case like this, where you discover that a particular word is causing a problem, and you expect that people are going to be using that word. You need to contact the administrator of your client's spam filter. At the very least they should whitelist that word. It might be better to have them whitelist your domain name and the IP address of the web server.

Are the email headers being blocked?

If all of your content seems to be okay. Then you need to check if the "invisible" parts of the email are causing a problem. Again, GMail is very useful for this. When you look at your email in GMail, there is a drop-down list on the top right labeled "Reply". If you click on the down arrow to the right of the word "Reply" you should see the option "Show Original". This will open up a new window with the raw text of the email, including the headers.

One of the things that the Mambo contact component does, is that it sets the Return-Path and the Reply-To in the original email to the email address that was entered in the contact form. This could raise flags in spam filters for the same reasons I described in the section titled "Is Mambo configured properly?" above. Unfortunately, you cannot change this behavior without changing the core code.

Why do I have to check all these Mambo settings?

I have written a ridiculously detailed analysis of the parts of the contact component that caused my problem, and posted it on the Mambo CMS Forum [http://forum.mambo-foundation.org/]. If you want to see the technical details, or may even want to change the code click on the link below:

[http://forum.mambo-foundation.org/showthread.php?t=4686&p=37547]