2mail — SMTP relay from Belgian infrastructure

SMTP for Drupal — site mail that arrives

By default, Drupal sends mail through the web server's PHP mail function: without authentication and without an established reputation. To Gmail and Outlook, such a message is barely distinguishable from spam — account activations and password reset emails that never arrive are the classic complaint.

The clean solution is Drupal's SMTP module. It replaces the default mail transport with a connection to an external SMTP server, without you having to change anything about your other modules or forms. The five fields below are all the module needs.

Why it goes wrong without a relay

A Drupal site is often more than a website: a member portal, an intranet, an application form for an association or a public body. That is exactly where mail is indispensable — someone who registers and gets no activation email gives up, and nobody tells you. The mail does leave, but it is rejected along the way because nothing proves it comes from your domain.

Setting up SMTP in Drupal

1

Collect your details

Log in to your 2mail account and retrieve your SMTP server, username and password there.

2

Fill them in inside Drupal

Install and enable Drupal's SMTP module. In that module's settings you switch it on as the mail transport, fill in host, port, encryption, username and password, and set the sender address to your own domain. The module has a built-in test email: send it to an external address at a major provider, not to an address on your own server.

3

Authenticate your domain

Make sure SPF, DKIM and DMARC are set correctly for your domain, so recipients can verify that the mail comes from you.

4

Test

Send a test message to an address at a major provider and check that it arrives in the inbox and not in the spam folder.

The fields Drupal asks for

Every platform names them slightly differently, but it is always the same five. The actual values are tied to your account and can be found in your 2mail account — take them from there, so you are sure to use the right ones.

Field What you enter
SMTP server (host)The server name from your 2mail account.
PortThe port that matches your chosen encryption; your account shows which one.
EncryptionTLS. Never send unencrypted — your credentials would otherwise travel in plain text.
UsernameThe SMTP login of your 2mail account.
PasswordThe matching password. Never use the password of an employee's mailbox.

Which emails Drupal sends

As soon as the relay is set up, all of these run through 2mail — you do not have to configure them one by one.

Account activation and password resets
Messages from contact and web forms
Notifications about new content, comments or workflow steps
Status reports and security alerts to administrators
Newsletters or digests sent from the site

Pitfalls with Drupal

The module has to actually be the mailer

Drupal can run several mail systems side by side. If the SMTP module is installed but not switched on as the mail transport, everything keeps going through the PHP mail function and nothing changes. Check that first when the test email arrives but real mail does not.

Sender on your own domain

The site email address in the basic settings is used as the sender. Set it to an address on your own domain — the same domain SPF, DKIM and DMARC are configured for. A free address fails DMARC, however correct the SMTP details are.

Configuration export and passwords

If you use configuration management, the SMTP settings travel along in the export. If an import overwrites them with the values of a test environment, your live site suddenly sends with the wrong details. Keep the password out of the export and set it separately per environment.

SPF, DKIM & DMARC explained About deliverability

A different platform?

SMTP is a standard protocol: any system that speaks SMTP — a CRM, an ERP, a custom application or a server — can send through 2mail using the same five fields.

Frequently asked questions about SMTP for Drupal

By default, Drupal sends through the web server's PHP mail function, without authentication or reputation. The message does leave, but it is rejected along the way or marked as spam because nothing proves it comes from your domain. An SMTP relay with correct SPF, DKIM and DMARC records fixes that.
Drupal's SMTP module. It asks for the generic SMTP details — host, port, encryption, username and password — and replaces the default mail transport. You do not need to change anything about your other modules or forms.
Usually the SMTP module is installed but not switched on as the mail transport, or another module sends through its own route. Check which mail system is actually active and whether a second module is sending mail.
In your 2mail account, per application. They are account-specific, so we do not publish them on the website. Preferably create a separate login for Drupal, so you can revoke it independently and track that traffic on its own.
Call us
Send an email