---
title: "PHPMailer"
description: "Send from any PHP app using the PHPMailer library."
url: https://www.unitpost.com/guides/smtp/php
section: SMTP
updated: 2026-07-24
---
# PHPMailer

## 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

## PHPMailer

> Send from any PHP app using the PHPMailer library.

Use PHPMailer's SMTP mode to deliver through Unitpost from plain PHP.

### 1. Install PHPMailer

Add it via Composer.

```bash
composer require phpmailer/phpmailer
```

### 2. Configure and send

Set PHPMailer to SMTP mode with your Unitpost credentials.

```php
<?php
use PHPMailer\PHPMailer\PHPMailer;

$mail = new PHPMailer(true);
$mail->isSMTP();
$mail->Host       = "smtp.unitpost.com";
$mail->SMTPAuth   = true;
$mail->Username   = "unitpost";
$mail->Password   = getenv("UNITPOST_API_KEY");
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
$mail->Port       = 587;

$mail->setFrom("you@yourdomain.com", "Your App");
$mail->addAddress("customer@example.com");
$mail->isHTML(true);
$mail->Subject = "Hello from Unitpost";
$mail->Body    = "<h1>Welcome!</h1><p>Sent via SMTP.</p>";
$mail->send();
```

### 3. Verify delivery

The message appears in your Unitpost Activity view with full tracking.

## Related

- [Nodemailer](https://www.unitpost.com/guides/smtp/nodemailer): Send from any Node.js app with the most popular SMTP client.
- [Supabase Auth](https://www.unitpost.com/guides/smtp/supabase): Deliver Supabase auth emails (magic links, confirmations) via Unitpost.
- [WordPress](https://www.unitpost.com/guides/smtp/wordpress): Route all WordPress email through Unitpost with an SMTP plugin.
