eusend
SMTP

PHP (PHPMailer) SMTP

Send email from plain PHP through eusend using PHPMailer over SMTP — implicit TLS on port 465, DKIM-signed and tracked.

For a PHP app without a framework, PHPMailer is the standard SMTP client. Point it at eusend and your mail is DKIM-signed, tracked, and subject to the same limits as the HTTP API.

Install

composer require phpmailer/phpmailer

Send an email

send.php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

require 'vendor/autoload.php';

$mail = new PHPMailer(true);

try {
    $mail->isSMTP();
    $mail->Host       = 'smtp.eusend.dev';
    $mail->SMTPAuth   = true;
    $mail->Username   = 'eusend';                       // the literal string "eusend"
    $mail->Password   = getenv('EUSEND_API_KEY');       // eu_live_…
    $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;    // implicit TLS
    $mail->Port       = 465;

    // From must be on a domain verified in eusend
    $mail->setFrom('[email protected]', 'Acme');
    $mail->addAddress('[email protected]');

    $mail->isHTML(true);
    $mail->Subject = 'Your order has shipped';
    $mail->Body    = '<p>Order #1234 is on its way.</p>';
    $mail->AltBody = 'Order #1234 is on its way.';

    $mail->send();
} catch (Exception $e) {
    echo "Send failed: {$mail->ErrorInfo}";
}

Use ENCRYPTION_SMTPS with port 465 (implicit TLS), not ENCRYPTION_STARTTLS. STARTTLS on 587 is not supported.

Connection reference

PropertyValue
Hostsmtp.eusend.dev
Port465 (or 2465)
SMTPSecurePHPMailer::ENCRYPTION_SMTPS
Usernameeusend
Passwordyour eusend API key (eu_live_…)
setFrom()an address on a verified domain

Use an eu_test_ key while developing — sends are tracked but not delivered. See the SMTP overview for limits and status codes.