
SwiftTrap for Mailtrap
v3.1.0SYMONOV · 2026年3月22日 上架
Send WordPress emails through the Mailtrap Email API (not SMTP). Bulk and transactional streams, categories, suppression list, email log.
- 正在使用
- 10+
- 评分
- 暂无
- 累计下载
- 1,042
- 最近更新
- 2026年11月25日
贡献者
截图





SwiftTrap is a drop-in replacement for wp_mail() that routes WordPress email through the Mailtrap Email Sending API instead of SMTP. It is purpose-built for Mailtrap — not a generic SMTP plugin with a Mailtrap preset — so it exposes Mailtrap-native features that SMTP cannot: bulk vs transactional stream routing, email categories, custom variables for tracking, suppression lists, and domain verification status.
Why HTTP API instead of SMTP?
- Lower latency — one HTTPS call per message, no MAIL FROM / RCPT TO / DATA round-trips.
- Better deliverability — Mailtrap routes API messages through its dedicated transactional and bulk streams; SMTP doesn’t expose stream selection.
- Native categories — every email is automatically categorized (welcome, password-reset, notification, marketing, etc.) so you can filter and report on them in Mailtrap.
- No firewall headaches — port 587/465 blocked? API works over standard HTTPS 443.
Why SwiftTrap and not WP Mail SMTP / Post SMTP
- Most generic mailer plugins treat Mailtrap as one provider among many and send everything through a single stream.
- SwiftTrap calls
send.api.mailtrap.iofor transactional mail andbulk.api.mailtrap.iofor bulk mail — automatically: newsletters from Newsletter, FluentCRM, Icegram Express and Groundhogg are recognized, and anything else can be routed by category, header or filter. - No Mailtrap PHP SDK required. Plugin is ~30 KB total and uses only the WordPress HTTP API (
wp_remote_post). - Stats page shows your sending domain verification status and the live suppression list (bounces, complaints, unsubscribes).
Features
- Drop-in replacement for
wp_mail()— works with WooCommerce, Contact Form 7, Gravity Forms, and any plugin that uses WordPress mail. - Newsletters through the bulk stream — one checkbox: campaign emails from Newsletter, FluentCRM, Icegram Express and Groundhogg go through Mailtrap’s bulk stream, everything else stays transactional. No setup in the newsletter plugin.
- Automatic email categorization and stream routing overrides via settings grid.
- Delivery Tracking & Webhooks — Real-time event tracking via custom REST route
swifttrap/v1/webhook. - Suppression Management — CRUD panel for Mailtrap suppression lists with pre-send recipient suppression checks.
- Backup delivery — if Mailtrap does not accept a message, WordPress can send it with its default mailer instead (on by default, can be switched off).
- API token is never shown again after saving, and can be kept out of the database with the
SWIFTTRAP_MAILTRAP_TOKENconstant inwp-config.php. - Site Health integration — Verification test checking Mailtrap token status and sending domain verification.
- Live Email Log — Browse and filter delivery data pulled directly from the Mailtrap API; search by recipient address, status, or date range with automatic pagination.
- WP-CLI commands — Command-line management via
wp swifttrap(test, stats, prune-logs, send-suppression-sync). - Attachment size guard — Configurable limits to prevent oversized files from rejecting at the API gateway.
- Test email to any address from the settings page, with the exact reason shown if Mailtrap refuses it.
- Mailtrap template support via
template_uuid. - Falls back to default WordPress mail handler when disabled or token is empty.
Extensible via filters
swifttrap_mailtrap_email_category— override the auto-detected email category.swifttrap_mailtrap_use_bulk_stream— force a message into the bulk or transactional stream (receives the category, the settings and the email itself).swifttrap_mailtrap_bulk_source— tell the plugin that an email comes from your own newsletter tool.swifttrap_mailtrap_fallback_to_wp_mail— decide per message whether a refused email may go out through the default mailer.- Header
X-SwiftTrap-Stream: bulk(ortransactional) on anywp_mail()call picks the stream for that message; the header is never forwarded to the recipient. swifttrap_mailtrap_template— send via a Mailtrap template bytemplate_uuid.swifttrap_mailtrap_custom_variables— attach tracking metadata to outgoing emails.
Privacy
This plugin sends email payloads (recipients, subject, body, attachments) to the Mailtrap API at send.api.mailtrap.io and bulk.api.mailtrap.io. Account stats and email logs are fetched from mailtrap.io/api/accounts and mailtrap.io/api/email_logs. See the Mailtrap Privacy Policy. No data is sent anywhere else.