What is the sender domain policy?
DreamHost’s sender domain policy exists to ensure email that is sent from your website is legitimate. This policy requires two things:
- You must use a FROM address that’s on the same website you’re sending email from
- The email must be hosted at DreamHost.
This policy only applies to email being sent directly from the web server, most often through a PHP contact form. If you use SMTP authentication, this policy DOES NOT apply to you. You can use SMTP authentication in a few ways:
An example of what is not allowed
If your website is example.com and you have a PHP mail form sending email, the FROM address in that email must be something like email@example.com. Emails that are sent from the web server using a FROM address from somewhere else (such as Yahoo or Google) will be blocked and never sent.
Emails sent through DreamHost's shared web servers must use a FROM address that is fully hosted at DreamHost. Forward only aliases will not work.
What happens if your email is blocked?
If this happens, you can see the mail failure in your FTP account.
- Log into your server via FTP.
- Make sure you're in your user's directory.
- In the right pane, look for the /Maildir folder. Click into it.
- In this directory are three folders.
- Click into the /new folder.
- In this folder you'll see files with long names. Right click and open in a text editor to view a file's contents.
Open the file in that directory to view why it failed to send. When emails are blocked by this policy, you’ll see the following error message:
5.7.1 Sender domain not allowed
Creating a script to view rejected email
Instead of manually checking the folder on your server, you could create a script that automatically emails you whenever an email is rejected. View the following article for further details:
When was this policy put into place?
The policy which restricts the 'from' address on emails was created in April of 2012. It was then slowly rolled out over the following months.
Why did DreamHost create this policy?
Over time, spoofed emails sent from DreamHost’s servers began to negatively affect the reputation of DreamHost's mail servers. This in turn threatened the ability to host mail at all with DreamHost. To protect the reputation of DreamHost’s mail servers and provide a stable and reliable service to customers, this policy was created.
How does this policy work?
The most accurate way to send email is to send them from the server where the domain's mail service is hosted. For example, email from Hotmail should be sent from Hotmail's servers and email from Google should be sent from Gmail's servers. DreamHost's mail policy states that emails sent through DreamHost's mail and shared web servers should only be 'from' domains that have their mail service hosted at DreamHost. So, when you send email from a DreamHost shared web server, you must do the following:
- The FROM address must be an email on your domain
- Your email must be hosted at DreamHost
This policy does not apply to DreamHost's VPS and Dedicated servers. Emails sent from a VPS or Dedicated server using PHP's mail(), Sendmail, or SMTP via localhost, are sent directly through the server's postfix mail system and go out to the recipient without passing through any other DreamHost server.
What domains am I not allowed to send from?
The list of blocked domains does not include every single domain that does not use DreamHost mail service. Instead, it’s a dynamic list maintained by DreamHost's mail administrators. While you may occasionally be able to send an email using a FROM address with a domain that is not hosted at DreamHost, there is no guarantee it won't be blocked in the future. To ensure your emails will not be blocked, only use a FROM address on a domain that uses DreamHost-hosted mail service. The other option is to use SMTP authentication in any website form. When you use SMTP authentication, you can then use any FROM address you like. View the Sending SMTP mail article for an example.
Where do blocked emails go? How do I find out if emails have been blocked from sending?
Blocked emails are returned to the sender as an 'undelivered' bounced email. Inside that bounced email are three things:
- A notification that the mail server could not deliver the email
- The error message the mail server provided as an explanation for it not being delivered
- A copy of the original email that could not be sent
Those bounced emails may be delivered to your regular mailbox, or they may be stored in the Maildir/new folder on the web server. DreamHost support can also check the server mail logs for any errors that may have been recorded. When you contact support, provide as many details as possible about the email you want them to research.
The following list includes the minimum amount of details you should provide:
- Date and time it was sent (including timezone)
- Email addresses it was sent TO
- Email address it was sent FROM
- The website URL for the web form that may not be working properly
If you find that your website form isn’t delivering email as it should, look in your user’s directory on your webserver. Log in via FTP, and then navigate to the Maildir/new folder. This folder will list any emails that failed to send properly.
The Maildir folder
Blocked emails will be filtered into your Maildir/new directory. A Maildir is a directory (often named Maildir) with three subdirectories named tmp, new, and cur. Maildir is a widely-used format for storing email that does not require application-level file locking to maintain message integrity as messages are added, moved and deleted. Each message is kept in a separate file with a unique name.
Example of acceptable FROM addresses
|How the email is sent||FROM address used||Explanation of address|
Examples of blocked FROM email addresses
Emails should not be sent with a FROM address hosted somewhere else. For example:
If you need to use any address not hosted with DreamHost as your FROM address, you must use SMTP authentication.
Example of a complete email
This is an example of an email sent by a website's contact form, such as when a site visitor fills out a submission form on your website. This example uses the domain example.com which is hosted at DreamHost:
From: Site Visitor <firstname.lastname@example.org> Reply-To: Site Visitor <SiteVisitor@gmail.com> To: Joe Website Owner <email@example.com> Subject: Contact Form Submission Date: 15 January 2015 10:47pm Site Visitor <SiteVisitor@gmail.com> filled out the contact form on your website at 10:47pm on 15 January 2015. Their message was: Hello. I’m interested in your services. Please call me at 555-555-5555.
- The 'From' header displays the email address hosted at DreamHost.
- The ‘From’ header displays the name of the site visitor. This is useful because when Joe checks his email, he can easily see the name of the site visitor.
- The Site Visitor's information is included in the email body.
- The Site Visitor’s information is also in the Reply-To header. This is useful because when Joe clicks 'reply', the email is automatically addressed to be sent to the Site Visitor's email address.