PHPMailer
Use PHPMailer's SMTP mode to deliver through Unitpost from plain PHP.
What are the SMTP 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 |
How do I set it up?
Install PHPMailer
Add it via Composer.
Shellcomposer require phpmailer/phpmailerConfigure 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();Verify delivery
The message appears in your Unitpost Activity view with full tracking.