Drupal Contact Form Workaround Dreamhost

Hi all,
First off - thanks LakeRat http://discussion.dreamhost.com/user-20209.html for responding to my initial post - http://discussion.dreamhost.com/thread-135041.html

If you have a Drupal site and use the contact form, all form submissions from gmail, yahoo, and hotmail are being blocked by Dreamhost in order to cut down on the amount of spam they have to process.

I patched together a few posts on the subject and this solution I have tested extensively, it works beautifully… it is a custom module that handles the contact form email submission parameters:

  • Implementation of hook_form_alter().

function form_overrides_mail_alter(&$message) {
if ($message[‘id’] == ‘contact_page_mail’) {
$message[‘headers’][‘Reply-To’] = $message[‘from’];
$message[‘body’][2] = $message[‘body’][1];
$message[‘body’][1] = 'Reply to this message using: '.$message[‘from’];
//$message[‘from’] = variable_get(‘site_mail’, ini_get(‘sendmail_from’));
$message[‘from’] = ‘ContactForm@kentlakefalconfootball.com’;
$message[‘headers’][‘From’] = $message[‘from’];
$message[‘params’][‘mail’] = $message[‘from’];

In this instance I hard-coded the “From” so it stands out like a sore thumb to the people receiving the emails - funny thing, that ContactForm@kentlakefalconfootball.com is a bunk email address and this is a workaround to a spam-fighter. Anyway, you could easily uncomment the “site_mail” to have it come from whatever you have set as the site email address in Drupal.

The person initiating the email from the form, the auto-responder they receive comes from the correct email at whatever category they chose to send it to (boosterclub, fundraising, spirit, etc).

The email that the @kentlakefalconfootball person gets says it’s from ContactForm@kentlakefalconfootball.com but if the person receiving the email hits “Reply” the response is populated with the actual sender’s address joeblow@hotmail.com etc. I added a line in the body with the sender’s email address just in case whatever email program doesn’t handle it that way. I only tested it in Gmail desktop, iPhone, and iPad.

Here is a link to download this custom module, it’s only 2 files… unzip into your /sites/all/modules folder and then go to /admin/build/modules and expand “Other” and enable “Custom Form Overrides” and you should be good to go.

Anyway, I know how frustrating it is to try to find this crap once it’s solved, so I decided to post this in case someone else was struggling with it like me. It bugs me to find a lot of questions about what you are trying to solve and then at the end the initial poster says “aha I got it”… end of thread, no solution. :~/

If you need help just hmu on this thread.

~ Jim
~ http://tentonweb.com/seo-resume.php
~ twitter: @seo_web_design

I would recommend creating this “From” address as an alias or “Forward Only” address, to the site admin’s or webmaster’s address. This creates a return path, should something go wrong with delivery of the form.

Great suggestion thanks LakeRat!
~ Jim[hr]
Pardon my language but this is really starting to piss me off - this was working great at 2am to various email addresses - this morning 10:30am - no email no auto-responder no nothing. What the heck… :~/[hr]
Here is a screenshot of the working email at 1:30am

OK I can chill out I guess - 30 minutes later the emails came through.
I’ll take it…


What do you mean ?

Visitors cannot contact us with a Drupal form if they use Gmail or Yahoo Email addresses ?!

I guess that I didn’t understand correctly ?

About a month ago Dreamhost instituted a policy to cut down on the amount of email spam they were processing.
That is - no emails from a website’s form will go through if the sender’s domain is yahoo mail, gmail, hotmail etc.

This - if you are using Drupal’s contact form - is a workaround for that policy.
It generates the email from your own domain, so it does make it through to you.
And, when you hit “reply”, it replies to the actual sender’s email address they entered on the web form, regardless of domain.

Hope that helps!
~ Jim

Just a note… Not a coder but with the modifications to the .info file to bring it in line with Drupal 7 coding standards this worked for me. Now to propagate it through 25 different drupal sites. I know - I should be using multisite more.

// ~ Jim Summer http://tentonweb.com/seo-resume.php
// from https://discussion.dreamhost.com/thread-135046-post-153903.html and modified for Drupal 7
name = Form Overrides
description = Adding some custom contact form overrides.
package = Other
core = 7.x

files[] = form_overides.module

version = “7.x-1.0”

We just discovered that we’ve been affected by this issue (likely for the last year). I’m not quite savvy enough to implement this on my own. Can someone here provide step by step instructions on how to do this?

Thanks lots,

I perfectly get messages sent from my contact forms even if sender emails are hotmail, yahoo or gmail, so I still do not understand…

Is that working OK for you? Thanks for upgrading to D7 I was just doing the quickest dirty fix I could to get the thing working. Did you happen to submit it back into the Drupal Community at drupal.org? I have never done that but would like to, just not sure how to go about it.

I can confirm this works fine with D7.


I tried this workaround about a month ago and it worked fine. Now it does not work at all.

I put it in for a D6 site earlier this week and it worked exactly as I expected.

I suspect your webserver made it to a RBL.

Just started working with Drupal 8. I had gotten this work around working 7, but cannot do so on 8. Has anybody had any luck?