-
-
Notifications
You must be signed in to change notification settings - Fork 0
Configuration
Go to Settings > MXRoute Mailer in your WordPress admin dashboard.
Your MXRoute server hostname. This is provided by MXRoute when you create your account.
Example: chocobo.mxrouting.net
Your MXRoute email address. This is also used as the From address for all emails sent through the plugin.
Example: you@mxroute.com
The username field displays your full email address (e.g., you@example.com) with the domain derived from your WordPress site URL. If you enter just the local part (e.g., you), the domain is appended automatically.
Your MXRoute account password. It is encrypted with AES-256-GCM using your site's WordPress auth salt before being stored in the WordPress database. The password is only decrypted when the plugin sends an email.
Use the test email form to verify your configuration:
- To: Enter the recipient email address
- Subject: Defaults to "MXRoute Mailer Test"
- Body: Defaults to "This is a test email from MXRoute Mailer."
- Options: Check Include file attachments to send all three attachment types
- Click Send Test Email
The response shows the queued status. The email is processed in the background by WP-Cron — check the Queue page for delivery status.
When the attachment checkbox is checked, the test email includes three distinct attachment types to exercise all storage paths:
| Attachment | Type | Storage behavior |
|---|---|---|
test-attachment-media.txt |
Media library ID | Created via wp_insert_attachment(), re-resolved at send time |
test-attachment.txt |
Persistent file path | Referenced as-is, no copy |
Temp file in sys_get_temp_dir()
|
Temp file (stored) | Copied to wp-content/uploads/mxroute-mailer-attachments/
|
Go to Tools > MXRoute Logs to view all processed emails (sent and failed). Pending emails in the queue are shown separately under Tools > MXRoute Queue.
Each log entry includes:
- Timestamp - When the email was sent
- Status - Sent, Failed, or Pending (pending shown on queue page only)
- From - The MXRoute username (sender address)
- Reply-To - The original sender address (if different from From)
- To - Recipient email address
- Subject - Email subject line
- Message - Full email body
- Headers - Email headers passed to the API
- Attachments - File attachments (supports file paths and WordPress attachment IDs)
-
Transport - How the email was sent:
api(MXRoute HTTP API for simple emails) orsmtp(SMTP for emails with attachments, creates a copy in the sent folder) - API Request - JSON payload sent to MXRoute
- API Response - MXRoute's response
The log detail page shows an Attachments section when attachments are present. Each attachment displays:
| Field | Description |
|---|---|
| Type |
Media ID 123 (WordPress media library), Temp file (stored) (volatile file copied to storage), or File (persistent file path) |
| Original Path | The source file path or media library resolution |
| Stored |
OK (copy exists in persistent storage), Missing (copy was deleted), or N/A (no copy needed — native reference) |
How attachment storage works:
The plugin handles three types of attachments intelligently to avoid unnecessary file duplication:
-
Media library IDs — Referenced by ID only, re-resolved from WordPress at send time. No copy created — media files are already persistent in
wp-content/uploads/. -
File paths in temp directories (e.g.,
/tmp/) — Copied to persistent storage atwp-content/uploads/mxroute-mailer-attachments/. These files are volatile and may be deleted before the queue processes, so a copy ensures reliable delivery. -
File paths in persistent locations (e.g., plugin upload directories) — Referenced by path only. No copy created — the file is already in a stable location.
The queue page also shows attachment status for each pending entry, with a count and storage indicator (green badge for all stored, red badge if any are missing).
You can filter logs by:
- Search - Subject, from, to, or reply-to address
- Status - Sent or failed
- From email - Filter by sender address
- Date range - Filter by date
From the logs page, you can re-queue any sent or failed email to be sent again:
- Click the Re-queue button on any log entry
- Use bulk actions to re-queue multiple entries at once
- Re-queued emails move to the queue and are processed by WP-Cron
- The log entry is removed from the logs view (appears on queue page)
Click Clear All Logs to delete all log entries. This action cannot be undone.
Go to Tools > MXRoute Queue to see emails waiting to be sent.
The queue processes emails in batches. Configure the batch size under Settings > MXRoute Mailer:
- Default: 5 emails per batch
- Range: 1-50 emails per batch
- Higher values process more emails per cron run
- All outgoing emails are queued instead of sent immediately
- WP-Cron triggers the queue processor in the background
- The processor sends emails in batches via the MXRoute API or SMTP (smart-switch)
- Each email is marked as sent or failed in the logs
- Pending emails are hidden from the logs page (view on queue page)
When any WordPress plugin or theme calls wp_mail(), MXRoute Mailer:
- Intercepts the email via the
pre_wp_mailfilter before WordPress invokes the default mailer - Queues the email for background processing via WP-Cron
- Schedules a single WP-Cron event to process the queue
- Returns
falseto WordPress so the default mailer is not invoked
The queue processor then:
- Fetches pending emails from the database in batches
- Extracts the
Fromheader (if any), sanitizes it, and sets it asReply-To - Uses your MXRoute username as the
Fromaddress - Sanitizes the recipient (
To) address - Applies the smart switch — chooses the best transport for each email:
- No attachments → MXRoute HTTP API (lightweight, no server storage)
- Has attachments → SMTP via PHPMailer (creates a copy in your MXRoute sent folder for legal records and documentation)
- Logs the full request and response, including which transport was used
- Marks the email as sent or failed
If the MXRoute API call fails, the email is marked as failed in the logs. You can re-queue it from the logs page to try again. If MXRoute Mailer is not configured, the plugin returns null and lets WordPress fall back to the default mailer.
When a plugin (like a contact form) sets a custom From header, the plugin:
- Uses your MXRoute username as the actual
Fromaddress (for deliverability) - Preserves the original sender address as the
Reply-Toheader - Stores the Reply-To address in the email logs
This means replies to contact form emails go to the person who submitted the form, not to your MXRoute username.
The plugin creates a database table {prefix}_mxroute_mailer_logs to store email logs. The table is created automatically on activation and updated automatically when new versions add columns.
| Column | Type | Description |
|---|---|---|
| id | bigint(20) | Auto-increment primary key |
| timestamp | datetime | When the email was created |
| from_email | varchar(255) | Sender address (MXRoute username) |
| reply_to | varchar(255) | Original sender address |
| to_email | varchar(255) | Recipient address |
| subject | varchar(255) | Email subject |
| message | longtext | Email body |
| headers | longtext | Email headers |
| attachments | longtext | JSON array of typed attachment references (id, path, or stored) |
| api_request | longtext | JSON API request |
| api_response | longtext | JSON API response |
| success | tinyint(2) | 1 = sent, -1 = failed, 0 = pending |
| transport | varchar(10) | Transport method: 'api' or 'smtp' |
| created_at | datetime | When the queue entry was created |
| processed_at | datetime | When the email was sent or failed |