Skip to content

CoreMail

Free built-in module. CoreMail sends your site's email through SMTP or an email provider. It logs every email, lets you resend from the log, can switch to a fallback provider, sends failure alerts and a weekly summary, and can turn off WordPress's own notification emails.

Open it from Automation > CoreMail in the OG AI Core rail (admin.php?page=ogmail_settings).

Tabs

  • Dashboard: the email log. Filter by status (All statuses, Sent, Failed, Offline, Pending), open an email, resend it, or Export CSV.
  • Settings: everything below.

Providers

Pick one in Email Provider > Provider:

WordPress (server mail), Generic SMTP, Generic SMTP (Second Server), Mailgun, Brevo, SendGrid, Amazon SES, Postmark, SMTP2GO, Mailjet, Resend, MailerSend, Maileroo, Gmail / Google Workspace, Microsoft 365 / Outlook, Microsoft 365 (App-only), Zoho Mail and ZeptoMail (Zoho CPaaS).

Two special choices:

  • None: CoreMail leaves wp_mail() alone. WordPress sends email as it always does.
  • Offline: emails are logged but never sent. Handy on a copy of a site.

Gmail, Outlook and Zoho Mail connect with OAuth. The redirect address to give the provider is admin.php?page=ogmail_settings on your site.

Fallback picks a second provider (or WordPress (server mail)) that is tried when the first one fails. The default is No fallback.

Settings

All settings are stored in the option ogmail_options.

Section Field Key Default
Email Provider Provider provider none
Email Provider Fallback fallback_provider none
Providers Host, Port, Encryption, Username, Password, API Key, Domain, Region and so on providers.<provider>.*
Sender From Email from_email
Sender From Name from_name
Sender Force From force_from
Sender Reply-To reply_to
Sender Return Path return_path
Test Email Format (HTML or Plain) test_format
Delivery & Logs Background Send send_in_background Off
Delivery & Logs Enable Logging logs_enabled On
Delivery & Logs Store Body log_body On
Delivery & Logs Keep Attachments store_attachments Off
Delivery & Logs Keep Logs For (Forever, 7, 30 or 90 days) log_retention_days Forever (0)
Alerts Failure Alerts alerts_enabled
Alerts Alert To alerts_email Site admin email
Alerts Weekly Summary summary_enabled
Alerts Summary To summary_email Site admin email
Alerts Also Post To (webhook) alerts_webhook
WordPress Notifications One switch per WordPress email blocked_notifications
Security Encrypt Credentials encrypt_secrets Off

WordPress Notifications can turn off: New User (to you), New User (to them), Password Changed, Email Changed, Admin Email Changed, Comment Awaiting Moderation, New Comment and Automatic Updates. Password reset emails cannot be turned off, on purpose.

Maintenance has Export Settings, Import Settings, Reset Settings and Delete All Logs. An importer can copy settings from a few other SMTP plugins when it finds them.

Multisite: Shared Settings keeps one setup for the network (network option ogmail_network), with Also Share Sender and Also Share Delivery. Logs always stay per site.

Good to know

  • Background Send never applies to emails with attachments.
  • Stored attachments are deleted after 30 days, even when logs are kept forever. An email whose attachments add up to more than 2 MB keeps none of them.
  • Alerts are sent at most once an hour, through WordPress's own mail rather than your provider, so you still hear about a broken provider. Webhooks are formatted for Slack and Discord.
  • Admin notices appear when emails failed in the last 24 hours, and when encrypted credentials can no longer be read.
  • Encrypt Credentials needs the Sodium PHP extension and real AUTH_KEY and SECURE_AUTH_KEY values in wp-config.php.

Credentials in wp-config.php

You can keep provider credentials out of the database with constants named OGMAIL_<PROVIDER>_<FIELD>:

define( 'OGMAIL_SMTP_PASSWORD', 'your-smtp-password' );

OGMAIL_ENCRYPTION_KEY pins the key used by Encrypt Credentials.

Developers

Table: {prefix}ogmail_logs (id, created, email_to, email_from, subject, headers, body, attachments, files, provider, status, error, retries).

Cron: ogmail_prune_logs (daily) and ogmail_weekly_summary (weekly).

REST namespace og-mailer/v1, for administrators only (ogmail_allow_setup):

  • GET /settings/list, /security/status
  • POST /settings/update, /settings/reset, /settings/network, /settings/export, /settings/import, /importer/import
  • POST /logs/list, /logs/get, /logs/delete, /logs/clear, /logs/resend, /logs/export, /logs/stats
  • POST /mail/test, /webhook/test, /notice/dismiss, /secrets/reveal, /security/encrypt, /oauth/auth-url, /oauth/disconnect

On a multisite network with shared settings, the routes that change the shared setup need a super admin on the main site.

Hooks:

Filter Arguments Use
ogmail_allow_setup bool $can (default current_user_can( 'manage_options' )) Who may open and change CoreMail.
ogmail_return_path string $return_path, array $email Change the bounce address.
ogmail_alert_webhook array $payload, string $event, string $url Change what is posted to the alerts webhook.
ogmail_stored_attachment_days int $days (30) How long stored attachments are kept.
ogmail_stored_attachment_limit int $bytes (2 MB) Largest total attachment size that is stored.
ogmail_run_phpmailer_init bool $run, array $email Return false to skip other plugins' phpmailer_init code for an email.

CoreMail also fires WordPress's own wp_mail_succeeded and wp_mail_failed actions and applies wp_mail_from, wp_mail_from_name, wp_mail_content_type and wp_mail_charset.

MCP tools: ogmail_get_status, ogmail_list_emails, ogmail_get_email, ogmail_send_test and ogmail_send_email. They are off until you tick CoreMail under Settings > MCP > MCP Tool Sets. See MCP tools.

Modules · Contact Form · MCP tools