Send Craft's email through the Groundmail API over HTTPS: account activation, password resets, Craft Commerce order email, form notifications and anything else your site sends with Craft's mailer.
Craft CMS 5.0 or later and PHP 8.2 or later.
composer config repositories.groundmail-craft vcs https://github.com/Groundmail/groundmail-craft
composer require groundmail/craft-plugin
php craft plugin/install groundmail-
In Groundmail, verify your sending domain and create an API key under API Keys. A send-only key is enough.
-
Add the key to your
.envfile:GROUNDMAIL_API_KEY=gm_your_key
-
In Craft, go to Settings > Email. Set System Email Address to an address on your verified domain.
-
Change Transport Type to Groundmail, and set API Key to
$GROUNDMAIL_API_KEY. Using the environment variable keeps the key out of your project config. -
Click Test to send a test email, then Save. To check the connection without emailing a real inbox, send the test to
delivered@simulator.groundmail.dev:php craft mailer/test --to=delivered@simulator.groundmail.dev
Groundmail sends transactional, product and newsletter email from separate IPs, so other mail never slows down your password resets. Email category sets the stream for the email Craft sends:
- Transactional (default): account email, password resets, order and form notifications.
- Product: email about your product to its users, such as onboarding tips. Recipients can opt out of product email and keep getting transactional email.
A single message can choose its own category with an X-Groundmail-Category header (transactional, product, or newsletter once your account is approved for newsletters) and add tags with X-Groundmail-Tag: name=value:
Craft::$app->getMailer()->compose()
->setTo($user->email)
->setSubject('Your order has shipped')
->setHtmlBody($html)
->addHeader('X-Groundmail-Tag', 'order=' . $order->number)
->send();Groundmail sends email to people who asked for it. Newsletters need your account approved (email support@groundmail.dev) and an opt-in list. Don't use Groundmail for cold email or for purchased, rented or scraped lists.
Only to https://api.groundmail.dev: each email Craft sends (sender, recipients, subject, content, attachments, custom headers) with its category. See the terms and privacy policy.
composer install
vendor/bin/phpunittests/e2e/run.py runs the plugin in a real Craft site, against the Groundmail API or a local mock of it; see the top of that file.
Open an issue or email support@groundmail.dev. Docs · Sign up free