Dreamhost’s New Mail Policy

So, about three weeks ago, Dreamhost decided to block all website e-mail messages sent from non-Dreamhost domain e-mails. This means that if the contact form on your website sends you messages “From” the person who filled out the form, you are no longer getting those messages. The solution is pretty easy (see the last section of this post), but since they didn’t tell anyone, there are messages missing. The good news is, that despite the word on the street that these messages are just gone and there’s nothing they can do, these messages are still on your server, and you can access them. To access the messages, you can FTP or sFTP into the server and navigate to:
/home/yourUsername/Maildir/new
(Note: Replace yourUsername with the username you used to log in to the server.)

You will see a list of files. Even though they do not have the .txt file extension, they are text files and can be opened with any text editing program.

You can also view these messages on the server directly. You will need Shell/SSH access activated on your account. You can do this in the control panel:

  1. Go to https://panel.dreamhost.com/ and log into your account.
  2. Click on “Manage Users” in the menu (it’s currently in a box labeled “Toolbox” at the top of the left-hand column).
  3. On the Users page, you can check in the “Type” column. If it says “Shell”, you are all set. If it says something else, click on “Edit” for your user, click the radio button next to “Shell Account”, and click “Save Changes”.
  4. It will take about 10 minutes or so for these changes to take affect. You will see a clock next to the user while these changes are being processed. Once the clock is gone, you are ready to log in.

Once you have shell access for your user, you can access the server with a shell program. I use Putty (http://www.putty.org/), but there are a large number of freely available options out there. To access the blocked messages:

  1. Log in via shell.
  2. At the prompt, type:
    cd /home/yourUsername/Maildir/new
    and hit enter/return. (Note: Replace yourUsername with the username you used to log in to the server.)
  3. At the prompt, type:
    ls -la
    and hit enter/return. (Note, those are lowercase L’s, not number ones.) This will give you a list of all of the files containing the messages and the dates for the files, etc. You can also just type:
    ls
    and hit enter/return to get a list of just the file names and no other information.
  4. To open a file, type:
    nano filename
    and hit enter/return. (Note, replace filename with the full name of the file you want to open, including the file extension.) I find it’s easiest to copy the name of the file (just highlight it using your mouse, and it will automatically be copied) and paste it at the prompt (to paste, just right-click, and it will be pasted where your cursor currently is).
  5. This will open the file in a program called nano. If you haven’t used nano before, you’ll need to use your keyboard to get around, not the mouse, so to scroll down, you can use either the down arrow or control + v (or command + v on a Mac). To scroll up, you can use either the up arrow or control + y (or command + y on a Mac).
  6. To copy the message, you just highlight it with your mouse, and it automatically copies so you can paste it into another program.
  7. To close the file, press control+x (or commend + x on a Mac). This will take you back to the prompt. (Note: If you have made any changes to the file, it will ask if you want to save the changes (overwrite the file). Just push “y” for yes or “n” for no.)
  8. To delete the message, type:
    rm filename
    and hit enter/return. (Note, replace filename with the full name of the file you want to open, including the file extension.)
  9. To log off of the server, just type:
    exit

To make sure your e-mails are not being blocked, don’t put the user’s e-mail address in the “From” section. It needs to go in the “Repy-To” section. In the “From” section, use an e-mail address that matches the website domain (it doesn’t have to be a real e-mail address, just the domain has to match), like: noreply@mydomain.com.

Here is how you would update a PHP mail() call:

Old way:
mail(“$sendTo”,”$subject”,”$messageContent\r\n”, “From: $name <$email>\r\n”);

New way:
mail(“$sendTo”,”$subject”,”$messageContent\r\n”, ‘From: Your Website <noreply@domain.com>’.”\r\nReply-To: $name <$email>\r\n”);

(Note: This code is not meant for you to use as is. It is just an example to show how you can add a Reply-To.)

Here’s how you would update Zend Mail:

Old way:

$mail = new Zend_Mail();
$mail->setBodyText($content);
$mail->setFrom($email, $name);
$mail->setSubject($subject);
$mail->addTo($sendto, $sendName);
$mail->send();

New way:

$mail = new Zend_Mail();
$mail->setBodyText($content);
$mail->setFrom(“noreply@domain.com”, “Your Website”);
$mail->setReplyTo($email, $name);
$mail->setSubject($subject);
$mail->addTo($sendto, $sendName);
$mail->send();

I hope this helps get your website e-mails back on track with Dreamhost.

7 thoughts on “Dreamhost’s New Mail Policy”

  1. Hi Beth,

    First, a very, very big thank you for writing this post.

    I had the unfortunate luck to redo Lisa Kokin’s website and post it live (last October) just as Dreamhost changed their email blocking rules. Since the contact form was tested and seemed to be working correctly, we assumed all was well. But Lisa started getting the occasional reports mentioning that, “I sent you an email but you did not respond”. I just thought it was a fluke because when we tested from our separate email accounts (both dreamhost) it worked fine. But the reports persisted and finally, I tested it from a friend’s computer (a non- dreamhost account) and low and behold the email was blocked. I found your post at 1:30am last night and discovered where to find the missing emails.
    Wow, wow, wow, I cannot thank you enough! Now Lisa can finally respond to some very important missing emails.

    I am in contact with dreamhost but in the event that they are not able to explain to me how to fix the php. Could I ask/hire you to step through it with me?
    From your post above I think I have deduced the following:

    If I change my php form from this:
    $headers = “From: $email” . PHP_EOL;
    $headers .= “Reply-To: $email” . PHP_EOL;
    $headers .= “MIME-Version: 1.0” . PHP_EOL;
    $headers .= “Content-type: text/plain; charset=utf-8” . PHP_EOL;
    $headers .= “Content-Transfer-Encoding: quoted-printable” . PHP_EOL;

    if(mail($address, $e_subject, $msg, $headers)) {

    To this:
    $headers = “From: lisakokin” . PHP_EOL;
    $headers .= “Reply-To: $email” . PHP_EOL;
    $headers .= “MIME-Version: 1.0” . PHP_EOL;
    $headers .= “Content-type: text/plain; charset=utf-8” . PHP_EOL;
    $headers .= “Content-Transfer-Encoding: quoted-printable” . PHP_EOL;

    if(mail($address, $e_subject, $msg, $headers)) {

    And then add the noreply@lisakokin.com as a catchall email in the cpanel at dreamhost? Would that be the right way to fix this?

    Again thank you so so much for your post. Finding the blocked emails in the Maildir/new this morning is life saver.

    Best,
    Lia

    1. Hi Lia,
      If you still need help on this let me know. I added a contact form to this site so you can get a hold of me if you need to.
      Thanks,
      Beth

  2. Thanks for the write up. Life-saver! One more question – my site returns ‘WordPress’ as the name of . Do you know of where this is set or how to change it?

    1. You can change the title of your site in the WordPress admin panel. Click on “Settings” and then on “General” in the menu bar on the left side of the page. The name of the site is in the “Site Title” box.

  3. Thanks for this! I was pulling my hair out for a good hour, testing a couple forms and scripts. Makes sense, with spam and spoofing and all – I don’t blame dreamhost (completely).

Leave a Reply

Your email address will not be published. Required fields are marked *