Craft CMS SMTP: four variables and the control panel
Account activation, password resets and forms: Craft CMS 5 sends through SMTP Senpai from Settings › Email, with the details kept in your .env file.
- Free plan, no card and no expiry
- Servers and data in the EU
- A log of every delivery
SMTP_HOST="relay.mailsenpai.com" SMTP_PORT="2525" SMTP_USERNAME="your-username" SMTP_PASSWORD="your-password" SYSTEM_EMAIL="[email protected]" # in the control panel: Hostname $SMTP_HOST · Port $SMTP_PORT # Use authentication: on # Username $SMTP_USERNAME · Password $SMTP_PASSWORD
Four details, and your emails go out
They are the same for every program: you also find them, already filled in, in your customer area.
The sender must be on a domain verified in your area: otherwise the server refuses to send. For SPF, DKIM and DMARC records, use the free email DNS checker.
Three steps
Write the variables
Add the lines shown here to your .env file, with the username and password from your customer area, SMTP Senpai page.
Set the transport
In Settings › Email choose Transport Type SMTP and type the variable names in the fields, with the dollar sign. System Email Address on a verified domain.
Test
Click Test at the bottom of the page, or from the terminal: php craft mailer/test [email protected]
Frequently asked questions
Where is the encryption field?
Craft 5 has none: on port 2525 or 587 the connection is protected with STARTTLS, which starts automatically.
The control panel is read-only in production: what now?
With allowAdminChanges off, settings are changed in development and reach production through project config. That is why it is better to type the variable names in the panel, not the values.
Why not type the password in the control panel?
Because it would end up in the project config YAML files. With $SMTP_PASSWORD it stays in the .env file.
The Test succeeds but the email does not arrive
Check that System Email Address is on a verified domain and look at the SMTP Senpai log: each delivery is listed line by line.
More integration guides
Try SMTP Senpai with your own software
Start free: connect your software, send your real emails and check the log line by line. No card and no expiry.