Home/Email API/PHPMailer via Composer

PHPMailer via Composer

composer require phpmailer/phpmailer takes ten seconds. It gives you a clean SMTP client, and precisely nothing that decides whether the email lands.

Verified By Kam Low, Co-founder · Updated July 20, 2026

The install and the honest setup

PHPMailer is the right library if PHP must speak SMTP: actively maintained, handles encoding and attachments, escapes the injection traps mail() invites.

Terminal + PHPcomposer
composer require phpmailer/phpmailer

$mail = new PHPMailer(true);
$mail->isSMTP();
$mail->Host = "smtp.example.com";  $mail->Port = 587;
$mail->SMTPAuth = true;
$mail->Username = "user";  $mail->Password = "pass";
$mail->setFrom("[email protected]");  $mail->addAddress("[email protected]");
$mail->Subject = "Welcome";  $mail->msgHTML("<p>You're in.</p>");
$mail->send();

What the install doesn't buy you

Deliverability needs more than that: an authenticated domain with SPF, DKIM, and DMARC aligned, warmed sending infrastructure, bounce and complaint handling, and a suppression list. PHPMailer transports; it cannot do any of those.

The comparison worth making is not PHPMailer vs mail(). It's ten lines of SMTP config and credentials vs one cURL POST with a bearer token, where the platform owns the landing.

We know exactly how heavy the real setup feels, because we measured ours: verifying a technical sending domain used to mean adding five DNS records, with four more recommended. Asking a developer to do that during onboarding is a non-starter, so we flipped the default. A fresh account reserves a protected Nitrosend brand subdomain without consuming provider resources. Preparing it creates DNS and provider infrastructure on demand; the first live send waits for readiness and explicit selection, with a 50-recipient rolling-24-hour commercial cap on Free. Composer gives you the library in ten seconds. Your first send deserves the same respect for your time.

Same logic applies to the email itself. Installing a library doesn't design the message any more than it delivers it, which is why I keep a dedicated email design skill on GitHub that does better anti-slop design than any default template. The tooling should raise the craft, not just move the bytes.

Full parameters and responses live in the REST API docs and the API reference.

The trap
Gmail app password
abcd efgh ijkl mnop
✕ 500 emails/day cap
✕ breaks when 2FA settings change
✕ a full-inbox credential in your code
The fix
POST /v1/messages
Authorization: Bearer ns_live_…
✓ scoped API key, revoke anytime
✓ 8,000 free sends, no daily cliff
✓ delivery events you can act on

Go deeper

The one-POST version: send email with PHP. Why the mail() starting point fails: PHP mail via SMTP. The port you pick matters less than the records behind it, so read SMTP ports alongside SPF, DKIM and DMARC authentication.

First send in thirty seconds.

Simple pricing. Unlimited contacts.

Every plan includes full stack emailing: Flows, Newsletter Campaigns and Transactional Email, plus our NitroWheel LLM and all agent integrations (Claude, ChatGPT, Codex, Cursor and others). Pay for what you send, not who you store.

Plan limits are ceilings, not guaranteed immediate send headroom; only mature, clean volume sent through that exact sender can raise its capacity.

Free
$0
forever
  • Emails 8,000then 500/mo
  • Email types Transactional & Marketing
  • AI actions 20/mo
  • Contacts Free & Unlimited
  • Brands 3
  • Seats 1
  • Commercial recipients / rolling 24h 50
  • Email validation Prepaid only
Start free
Ultra
$100
per month
  • Emails 125,000/month
  • AI actions 5,000/mo
  • Brands 10
  • Seats 10 · Domains 10
  • Frontier AI Included
  • Dedicated IP Available
  • Commercial recipients / rolling 24h 62,500
  • Email validation Prepaid only
Get started
Enterprise
$300
per month
  • AI actions Unlimited
  • Unlimited brands & domains Included
  • SSO / SAML Included
  • 99.9% SLA Included
  • Commercial recipients / rolling 24h Contracted
  • Email validation Prepaid only
Get started

Free forever. No credit card required. See full comparison →