SMTP Relay

Send emails via standard SMTP (port 587) using your Posthawk API key — compatible with any SMTP client (Nodemailer, PHPMailer, smtplib, etc.).

Posthawk includes a standard SMTP submission relay on port 587. This lets you send email from any language or framework that supports SMTP, without changing to a REST API.

Connection details:

• Host: smtp.posthawk.dev (cloud) or your server hostname (self-hosted)
• Port: 587
• Encryption: STARTTLS
• Username: posthawk
• Password: your API key (e.g. ck_live_...)

The SMTP relay supports AUTH PLAIN and AUTH LOGIN mechanisms.

In cloud mode, the relay verifies that the "From" domain is a verified domain in your workspace before relaying through AWS SES.

Example — Node.js (Nodemailer):

const nodemailer = require('nodemailer');

const transporter = nodemailer.createTransport({
  host: 'smtp.posthawk.dev',
  port: 587,
  secure: false,
  auth: { user: 'posthawk', pass: 'ck_live_...' },
});

await transporter.sendMail({
  from: 'hello@yourdomain.com',
  to: 'user@example.com',
  subject: 'Hello via SMTP',
  html: '<h1>Hello!</h1>',
});

Example — Python (smtplib):

import smtplib
from email.mime.text import MIMEText

msg = MIMEText('<h1>Hello!</h1>', 'html')
msg['From'] = 'hello@yourdomain.com'
msg['To'] = 'user@example.com'
msg['Subject'] = 'Hello via SMTP'

with smtplib.SMTP('smtp.posthawk.dev', 587) as server:
    server.starttls()
    server.login('posthawk', 'ck_live_...')
    server.send_message(msg)

All emails sent via SMTP are logged in the dashboard and count toward your rate limits and plan usage, just like API-sent emails.