---
title: "Laravel"
description: "Point Laravel's mail config at Unitpost with a few env vars."
url: https://www.unitpost.com/guides/smtp/laravel
section: SMTP
updated: 2026-07-24
---
# Laravel

## Connection settings

- **Host**: smtp.unitpost.com
- **Username**: unitpost (always this literal value)
- **Password**: Your Unitpost API key (must carry emails:send)
- **Port (STARTTLS)**: 587 (or 2587 if blocked)
- **Port (implicit TLS)**: 465 (or 2465 if blocked)
- **From address**: Any address on a verified domain

## Laravel

> Point Laravel's mail config at Unitpost with a few env vars.

Laravel reads SMTP settings from your `.env`. Point the mailer at Unitpost and you're done.

### 1. Set your mail environment variables

Add the following to your `.env` file.

```bash
MAIL_MAILER=smtp
MAIL_HOST=smtp.unitpost.com
MAIL_PORT=587
MAIL_USERNAME=unitpost
MAIL_PASSWORD=${UNITPOST_API_KEY}
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=you@yourdomain.com
MAIL_FROM_NAME="${APP_NAME}"
```

> MAIL_FROM_ADDRESS must be on a domain you've verified in Unitpost.

### 2. Clear the config cache

If you cache config in production, refresh it so the new values load.

```bash
php artisan config:clear
```

### 3. Send and verify

Send a mailable (e.g. `Mail::to($user)->send(new WelcomeMail())`) and confirm it in your Unitpost Activity view.

## Related

- [Django](https://www.unitpost.com/guides/smtp/django): Use Django's SMTP email backend with Unitpost.
- [PHPMailer](https://www.unitpost.com/guides/smtp/php): Send from any PHP app using the PHPMailer library.
- [Nodemailer](https://www.unitpost.com/guides/smtp/nodemailer): Send from any Node.js app with the most popular SMTP client.
