Integration guide · Laravel

Laravel SMTP: six lines in your .env

Notifications, password resets and mailables: Laravel sends through SMTP Senpai by changing only the .env file.

  • Free plan, no card and no expiry
  • Servers and data in the EU
  • A log of every delivery
Reviews of the MailSenpai service, not this connectorGoogleGoogleCapterraCapterraTrustpilotTrustpilotG2G2
.env
MAIL_MAILER=smtp
MAIL_HOST=relay.mailsenpai.com
MAIL_PORT=2525
MAIL_USERNAME=your-username
MAIL_PASSWORD=your-password
[email protected]
MAIL_FROM_NAME="${APP_NAME}"
# up to Laravel 10: MAIL_ENCRYPTION=tls
the 4 details

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.

Serverrelay.mailsenpai.com
Port2525 or 587
SecuritySTARTTLS
Username and passwordin the customer area, SMTP Senpai page

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. After the first send, the free email spam test gives it a score from 0 to 10.

how to

Three steps

1

Copy the details

You find username and password in the customer area, SMTP Senpai page.

2

Update .env

Paste the lines and, if you cache your config, run php artisan config:clear.

3

Test it

With php artisan tinker: Mail::raw('Test', fn ($m) => $m->to('[email protected]')->subject('Test'));

Prefer the API to SMTP? The official package adds a smtpsenpai mailer to Laravel 12 and 13: set MAIL_MAILER=smtpsenpai and MAILSENPAI_API_KEY, and your mail goes out over HTTPS, also where SMTP ports are blocked.

composer require mailsenpai/laravel

PackagistGitLabAll integrations

from installation to a received message

API setup and a first verified send

Requires PHP 8.2+ and Laravel 12 or 13 for the official API package. Install composer require mailsenpai/laravel. Keep the API key in your server environment and use a sender domain verified in your account.

MAIL_MAILER=smtpsenpai
MAILSENPAI_API_KEY=msp_REPLACE_WITH_YOUR_KEY
MAIL_FROM_ADDRESS=orders@YOUR_VERIFIED_DOMAIN
MAIL_FROM_NAME="Your application"

After changing configuration, refresh the configuration cache according to your deployment process and restart long-running queue workers. In a test environment, use Mail::raw() with a mailbox you control; inspect the API result and delivery events before testing a queued mailable. A successful queue job is not proof of inbox delivery.

Read the error before retrying

An invalid-key error requires checking the saved key and account state. A sender-domain rejection requires verifying that domain. A quota or rate-limit response requires waiting for the relevant limit or reviewing the plan; a network timeout requires checking outbound connectivity. Avoid blind retries: they do not correct credentials or DNS. Keep credentials and customer information out of public logs.

Use the official package page, source and setup reference and API error and delivery-event documentation. Service logs are retained for 7 days on the free plan and 90 days on paid plans. A local application log may have different retention.

Frequently asked questions

Do I need MAIL_ENCRYPTION?

Not from Laravel 11: on port 2525 or 587 STARTTLS starts automatically. Up to Laravel 10, set MAIL_ENCRYPTION=tls.

Do queued mails work?

Yes: queued mailables use the same SMTP mailer when the worker sends them.

Can I send without SMTP?

Yes. On Laravel 12 or 13, the official mailsenpai/laravel package adds an API mailer over HTTPS. Set MAIL_MAILER=smtpsenpai and MAILSENPAI_API_KEY, then test a message. SMTP remains an alternative using your relay credentials.

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.

Free, no card and no expiryFree plan