Skip to main content
GrN.dk

Main navigation

  • Articles
  • Contact
  • Your Digital Project Manager
  • About Greg Nowak
  • Services
  • Portfolio
  • Container
    • Excel Freelancer
    • Kubuntu - tips and tricks
    • Linux Apache MySQL and PHP
    • News
    • Image Gallery
User account menu
  • Log in

Breadcrumb

  1. Home

Sending Mail with Drupal: Reliable Email Setup for Business Sites

By Greg Nowak. Last updated 2026-06-30.

Email is one of those Drupal features that only gets attention after it fails. A password reset does not arrive. A quote request lands in spam. An internal approval email works on staging but disappears in production. The site may look healthy, while the business process behind it is leaking trust.

For a modern Drupal 10 or 11 site, reliable email is not just a coding task. Drupal has to compose the message cleanly, the transport has to hand it to the right mail service, and the sending domain has to be trusted by recipient systems. Treat those as three separate responsibilities and the setup becomes much easier to reason about.

Let Drupal Compose, Let Mail Infrastructure Deliver

Drupal core provides a mail manager service for composing and optionally sending messages. In custom code, the usual pattern is still to call plugin.manager.mail and let your module implement hook_mail() for the subject, body, and headers that belong to that message type.

That split is useful. Business logic stays near the feature that owns it, text is easier to review, and the delivery backend can change later without rewriting every notification. The important operational caveat is that Drupal's success result only means the message was accepted at PHP level. It does not prove that Gmail, Microsoft 365, or a customer's mail server accepted it.

$mailManager = \Drupal::service('plugin.manager.mail');
$params = [
  'customer_name' => $customerName,
  'project_name' => $projectName,
];

$result = $mailManager->mail(
  'my_module',
  'project_notice',
  $to,
  $langcode,
  $params
);

Choose the Right Mail Path

The best setup depends on risk, volume, and how polished the emails need to be. Most business sites should avoid relying blindly on PHP mail(), especially when contact forms, onboarding flows, commerce emails, or operational alerts matter.

Drupal email setup decision matrix
Option Best fit Watch point
Host PHP mail or sendmail Low-risk development or simple internal notifications on a well-managed server Depends heavily on host mail configuration and gives limited delivery visibility
SMTP Authentication Support Most business sites that need authenticated relay through Microsoft 365, Google Workspace, SendGrid SMTP, Mailgun SMTP, or similar SMTP only; provider APIs, webhooks, and advanced analytics need another layer
Core Symfony mailer backend Teams wanting a Drupal core transport replacement configured with a DSN Still marked experimental in Drupal 11 API docs, so use deliberately
Mailer Plus Sites needing richer HTML email, attachments, embedded images, async sending, or more advanced mail architecture Larger migration and maintenance decision; evaluate project status before adopting

A Practical SMTP Baseline

For many Drupal sites, the simplest reliable path is authenticated SMTP through a provider already responsible for the organization's mail. The Drupal SMTP Authentication Support module is built for this: it bypasses PHP's native mail() function and sends directly to an SMTP server. Its current stable release supports Drupal 9.5, 10, and 11.

composer require 'drupal/smtp:^1.4'

After installing it, configure the SMTP host, port, encryption mode, username, and password in Drupal configuration or through your deployment process. Keep credentials out of code where possible. Use the hosting platform's secrets manager, environment variables, or another controlled configuration path.

If you are testing Drupal core's Symfony mailer backend instead, use a settings override like this and adapt the host, port, and credentials to your provider:

$config['system.mail']['interface'] = [
  'default' => 'symfony_mailer',
];
$config['system.mail']['mailer_dsn'] = [
  'scheme' => 'smtp',
  'host' => getenv('SMTP_HOST'),
  'port' => 587,
  'user' => getenv('SMTP_USER'),
  'password' => getenv('SMTP_PASS'),
  'options' => [],
];

Do not choose Symfony mailer just because it sounds newer. Core's backend is useful as a transport replacement inside Drupal's existing mail model. If the real requirement is branded multipart email, attachments, provider-specific APIs, queueing, or failover, that is a broader mail-system decision.

Make the From Address Boring and Correct

A common mistake is using the visitor's email address as the visible From: address on contact form messages. That often breaks authentication because your Drupal site is not authorized to send on behalf of the visitor's domain. Use a verified site domain in From:, such as [email protected], and put the visitor's address in Reply-To when appropriate.

This is also easier for staff. The message clearly came through the website, replies still go to the customer, and the sending domain can be authenticated consistently.

Deliverability Is Part of the Build

Since February 1, 2024, Google's Gmail sender requirements have made the baseline very explicit. All senders to Gmail accounts need SPF or DKIM authentication. Senders above 5,000 messages per day to Gmail need SPF, DKIM, and DMARC, along with other requirements such as TLS, valid forward and reverse DNS, low spam rates, and aligned sender identity.

Even if your Drupal site is not a bulk sender, the same checklist is sensible. Publish SPF for the service that sends the mail. Turn on DKIM signing with the provider. Add DMARC, starting with a monitoring policy if the domain has not used it before. Test real messages to Gmail, Microsoft 365, and your own mailbox, then inspect headers rather than trusting the Drupal success message.

What to Check Before Launch

  • Confirm every transactional email has a clear owner, recipient, subject, and fallback path.
  • Use a verified domain in From: and reserve Reply-To for customer responses.
  • Send test messages from production-like infrastructure, not only from local development.
  • Check logs in Drupal and in the mail provider, especially for rejected authentication or TLS errors.
  • Retest after DNS changes, mail provider changes, hosting migrations, and form redesigns.

The goal is not an overbuilt mail platform. The goal is a setup your team can understand, monitor, and fix without guesswork. If your Drupal emails support sales, support, compliance, or customer onboarding, that reliability is worth designing on purpose.

If you want a practical review of a Drupal mail flow, delivery problem, or modernization plan, talk to Greg about tightening the setup before missed messages become a business problem.

Related on GrN.dk

  • Sending Mail From a Linux Server with Postfix: A Practical Setup Guide
  • CMS Upgrades in 2026: A PHP Roadmap for WordPress and Drupal Sites
  • Fixing Website Email Deliverability in 2026: A Practical Checklist for Business Sites

Need help with this kind of work?

Talk to Greg about Drupal email Get in touch with Greg.

Sources

  • MailManagerInterface | Drupal API
  • SymfonyMailer | Drupal API
  • SMTP Authentication Support | Drupal.org
  • Mailer Plus (DSM+) | Drupal.org
  • Email sender guidelines | Gmail Help
Last modified
2026-06-30

Tags

  • Drupal
  • Email Delivery
  • Drupal development
  • Website Operations
  • Symfony Mailer
  • Log in to post comments

Review Greg on Google

Greg Nowak Google Reviews

 

Illustrated infographic summarizing: Cloudflare Service Keys Stop in September: Find Every Caller
Cloudflare Service Keys Stop in September: Find Every Caller
2026-07-20

Cloudflare Service Keys stop working on September 30, 2026. Here is how to find every caller, move to scoped API tokens and avoid a late outage.

Illustrated infographic summarizing: Your AI Workflow Needs an Acceptance Test Before It Meets Customers
Your AI Workflow Needs an Acceptance Test Before It Meets Customers
2026-07-19

A practical way to test AI workflows using realistic scenarios, tool checks, human rubrics, regression suites, and clear release gates.

Three cover candidates for The Goats Were Load-Bearing fanned on a dark background: an ember-lit door, three slow knocks, and a founders' ledger
The Goats Were Load-Bearing: a fantasy where the bill always comes due
2026-07-19

A teaser for the upcoming darkly comic fantasy novel The Goats Were Load-Bearing — a village, a door that must stay poor, and the worst possible time to sell the herd. Readers pick the cover.

Vegan Power game: the yellow player catches falling fruit while a chicken and a cow look on
Vegan Power: The Little Game About Eating Fruit, Not Friends
2026-07-19

Vegan Power is a free browser game where you catch fruit, dodge the animals, protect seven hearts, and chase a better high score.

KotobaMon title screen: the Japanese logo コトバモン over a low-poly 3D island with monsters, cherry-blossom trees and a trainer.
KotobaMon: Shipping a 3D Browser Game With No Build Step and Self-Hosted Voice
2026-07-19

A look at fantasy.grn.dk, a browser-based 3D game that teaches Japanese with no build step, procedural art and self-hosted AI voice, and what its constraints show about shipping interactive products fast and cheap.

Illustrated infographic summarizing: WordPress Forced an Emergency Update. Did Every Site Take It?
WordPress Forced an Emergency Update. Did Every Site Take It?
2026-07-18

WordPress pushed an emergency security update, but teams still need to confirm the right patched version and core integrity on every installation.

Illustrated infographic summarizing: IndexNow: Wire corrections and deletions into the CMS
IndexNow: Wire corrections and deletions into the CMS
2026-07-17

IndexNow works best when CMS workflows report updates, redirects and removals as well as new pages. Here is how to cover the full content lifecycle.

Illustrated infographic summarizing: The EU’s August AI Deadline Reaches Bots and Synthetic Content
The EU’s August AI Deadline Reaches Bots and Synthetic Content
2026-07-16

Article 50 applies from 2 August 2026. Businesses need to map AI touchpoints, clarify ownership, and put workable transparency controls in place.

Illustrated infographic summarizing: A Voice Agent Is Only Ready When the Human Handoff Works
A Voice Agent Is Only Ready When the Human Handoff Works
2026-07-15

A practical guide to voice agents that recognise failure, pass useful context to staff, protect customer data, and improve resolution after launch.

Illustrated infographic summarizing: If the Facts Need JavaScript, AI Search May Miss the Full Page
If the Facts Need JavaScript, AI Search May Miss the Full Page
2026-07-14

A practical guide to finding and fixing JavaScript rendering gaps that can hide services, prices, contact details and metadata from AI search crawlers.

More articles
RSS feed

GrN.dk web platforms, web optimization, data analysis, data handling and logistics.