How do I send email from my app with SMTP or the API?
Any app, framework or plugin that can send through SMTP works, and so does the HTTP API. Verify your domain first: you can only send from addresses on a verified domain.
Create a key
Section titled “Create a key”- Open Email → Email API in the portal menu, then the Keys tab.
- Choose SMTP key or API key, give it a name, and click Create key.
- Copy the key right away. It isn’t shown again; click I saved it when you’re done.
Lost a key? Delete it and create a new one. Use a separate key for each app, so you can replace one without touching the others.
SMTP settings
Section titled “SMTP settings”The Overview tab lists your exact settings under How to send:
- SMTP server: the host shown there (for example
postal20.phluit.net) - Port: 587 (or 25), with STARTTLS
- Username: the username shown there
- Password: your SMTP key
Example for a Laravel .env file:
MAIL_MAILER=smtpMAIL_HOST=postal20.phluit.netMAIL_PORT=587MAIL_ENCRYPTION=tlsMAIL_USERNAME=your-username-from-how-to-sendMAIL_PASSWORD=your-smtp-keyMAIL_FROM_ADDRESS=noreply@mail.example.comIn WordPress, use an SMTP plugin with the same values.
HTTP API
Section titled “HTTP API”Send a POST request to the API address shown under How to send, with your API key in the X-Server-API-Key header:
curl -X POST https://postal20.phluit.net/api/v1/send/message \ -H "X-Server-API-Key: your-api-key" \ -H "Content-Type: application/json" \ -d '{"from": "noreply@mail.example.com", "to": ["customer@example.org"], "subject": "Your receipt", "plain_body": "Thanks for your order."}'You can also send html_body, cc, bcc, reply_to, tag and attachments. The reply contains an ID for each recipient, which you can look up on the Activity tab.
If your app gets an error
Section titled “If your app gets an error”- 535 Mail server has been suspended (SMTP) or ServerSuspended (API): sending is waiting for approval or is paused. See Why was my email sending paused?
- A From address that isn’t on a verified domain is refused. Check the Domains tab.
Was this helpful?
Thank you. If something is missing, tell us.
