SMTP Relay
Use PostStack as an SMTP relay for applications that cannot use the REST API. All features including tracking, webhooks, and analytics work with SMTP.
Implicit TLS only. The relay accepts implicit-TLS connections on port 587 (RFC 8314). Set secure: true in nodemailer or use Python's smtplib.SMTP_SSL. Plaintext or STARTTLS-only clients will be rejected.
Connection Details
| Setting | Value |
|---|---|
| Host | smtp.poststack.dev |
| Port | 587 (implicit TLS) |
| Encryption | TLS 1.2 / 1.3 required from connection start |
| Username | poststack |
| Password | Your API key (sk_live_...) |
Mailbox users can also authenticate with their email address and mailbox password instead of an API key. See the Mailboxes docs for email client setup.
Custom Headers
Add PostStack-specific headers to your SMTP messages to use advanced features:
| Header | Description |
|---|---|
X-PostStack-Idempotency-Key | Prevent duplicate sends with a unique idempotency key |
X-PostStack-Tags | Comma-separated tags for categorizing emails |
X-PostStack-Template-Id | Use a published template by ID |
X-PostStack-Variables | JSON-encoded template variables |
Node.js (Nodemailer)
Use Nodemailer with PostStack SMTP credentials. Note secure: true — TLS is required from connection start.
import nodemailer from 'nodemailer';
const transporter = nodemailer.createTransport({
host: 'smtp.poststack.dev',
port: 587,
secure: true, // implicit TLS — required
auth: {
user: 'poststack',
pass: 'sk_live_...',
},
});
await transporter.sendMail({
from: 'you@yourdomain.com',
to: 'user@example.com',
subject: 'Hello from PostStack SMTP',
html: '<p>Sent via SMTP relay!</p>',
headers: {
'X-PostStack-Tags': 'welcome,onboarding',
},
});Python (smtplib)
Use smtplib.SMTP_SSL for implicit TLS:
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
msg = MIMEMultipart("alternative")
msg["From"] = "you@yourdomain.com"
msg["To"] = "user@example.com"
msg["Subject"] = "Hello from PostStack SMTP"
msg["X-PostStack-Tags"] = "welcome,onboarding"
html = "<p>Sent via SMTP relay!</p>"
msg.attach(MIMEText(html, "html"))
with smtplib.SMTP_SSL("smtp.poststack.dev", 587) as server:
server.login("poststack", "sk_live_...")
server.sendmail(
"you@yourdomain.com",
"user@example.com",
msg.as_string(),
)Using Templates via SMTP
Reference templates and pass variables through custom SMTP headers:
await transporter.sendMail({
from: 'you@yourdomain.com',
to: 'user@example.com',
subject: '', // Overridden by template
text: '', // Overridden by template
headers: {
'X-PostStack-Template-Id': 'tpl_abc123def456ghi789',
'X-PostStack-Variables': JSON.stringify({
first_name: 'Alice',
company_name: 'Acme Inc',
}),
},
});