PHPMailer

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

What are the SMTP settings?

Hostsmtp.unitpost.com
Usernameunitpost(always this literal value)
PasswordYour Unitpost API key(must carry emails:send)
Port (STARTTLS)587(or 2587 if blocked)
Port (implicit TLS)465(or 2465 if blocked)
From addressAny address on a verified domain

How do I set it up?

  1. Install PHPMailer

    Add it via Composer.

    Shell
    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.