Skip to content

Sending mail ​

PHP's mail() works on every PHP site whose domain has its mail with us. Such a site gets its own send-only address, and mail() hands each message to our mail server under that address. There is nothing to configure: anything that sends through mail() uses it, including WordPress without an SMTP plugin, cron jobs and commands in the console.

The site's Overview has a Mail from PHP card. It shows the address and the limits that apply, or the reason the site has no sender.

When a site gets a sender ​

The site's domain has to meet all of these:

  • It is in your account.
  • Mail is switched on for it, and the domain is verified.
  • Its MX records point at us.
  • Its SPF or DKIM record is in place.

A site on a subdomain uses the domain it belongs to, so shop.example.com qualifies through example.com. Static sites run no PHP and get no sender.

A new site gets its sender within 10 minutes. After you change a domain's DNS or mail settings, allow up to an hour for the site to follow.

When the card names a reason instead of an address:

The card saysWhat to do
Mail is hosted elsewhereSee Mail hosted elsewhere
Mail is switched off or not includedSwitch mail on under Email → Domain Settings. If its mail is with another provider, see Mail hosted elsewhere
The domain is not verified for mailVerify the domain under Email → DNS & Setup
The SPF or DKIM record is missingSet up the records under Email → DNS & Setup
Add your own domainThe site only has a platform hostname. Add a domain to it
The site is suspendedA suspended site has no sender. It gets one again when it is resumed

The address ​

Site hostnameSender address
example.com or www.example.comwebsite@example.com
shop.example.comwebsite-shop@example.com

If that address is already taken, a number is added, as in website-2@example.com.

The address only sends:

  • It receives nothing. Mail to it is refused, so replies and bounces sent to it are lost. Put the address that should get replies in Reply-To.
  • It cannot read mail. The portal does not show its password, and it cannot sign in over IMAP or POP3.
  • The name is reserved. No mailbox or alias whose name starts with website can be created on any domain.

The From address ​

Every address in From, and in Sender or Resent-From if your code sets them, has to be on the domain of the site's sender address or a subdomain of it. If your code sets no From, the site's address is used. Anything else is refused:

text
550 5.7.1 From address not permitted for this sender

Contact forms are where this usually comes up. The visitor's address belongs in Reply-To, so that answering the message still reaches them:

php
mail('info@example.com', 'Contact form', $body, [
    'From' => 'website@example.com',
    'Reply-To' => 'visitor@example.org',
]);

Limits ​

Each site has its own limit, counted in recipients: a message to three people counts three.

PeriodRecipients
Per hour200
Per day1,000

For the first 30 days after your customer account was registered, the stricter sending limit for new accounts applies instead: 30 recipients per hour and 100 per day. A refused message counts nothing. If a site needs a higher limit, contact support.

Mail sent this way also counts towards the domain's monthly outbound messages, the same as mail from a mailbox. See Email.

Nothing is queued ​

When the server refuses a message, because of the From rule, a limit, or a temporary problem on our side, mail() returns false and the message is gone. Nothing retries it, so check the return value.

The server's answer is in the site's Logs, under Error Logs:

text
msmtp: server message: 452 4.7.1 Rate limit exceeded

For mail sent from a cron job, the answer is in that run's output instead: Cron, then Runs, then Output.

To test sending, run this in the Console, with your own address:

sh
php -r 'var_dump(mail("you@example.com", "Test", "Test message"));'

bool(true) means the server accepted the message. On bool(false), the console output shows the reason.

Mail hosted elsewhere ​

If the domain's MX records point at another provider, such as Microsoft 365 or Google Workspace, the site gets no sender. Our server does not send for a domain whose mail is handled somewhere else. A domain with no MX records at all counts the same way; if its mail is meant to be with us, add the records under Email → DNS & Setup.

Send through your provider instead, with an SMTP plugin or your framework's SMTP setting, using your provider's server, port 587 or 465, and a mailbox login there. In WordPress, an SMTP plugin also takes over wp_mail().

What's next ​