Artı Teknoloji - Teknolojiye Artı
MyBB Email Deliverability: SMTP Relays, DKIM/DMARC, and Mail Queues - Baskı Önizleme

+- Artı Teknoloji - Teknolojiye Artı (https://www.artiteknoloji.com)
+-- Forum: Web Tabanlı Uygulamalar (https://www.artiteknoloji.com/forumdisplay.php?fid=44)
+--- Forum: MyBB (https://www.artiteknoloji.com/forumdisplay.php?fid=48)
+--- Konu Başlığı: MyBB Email Deliverability: SMTP Relays, DKIM/DMARC, and Mail Queues (/showthread.php?tid=572)



MyBB Email Deliverability: SMTP Relays, DKIM/DMARC, and Mail Queues - Wertomy® - 19-11-2026

MyBB Email Deliverability: SMTP Relays, DKIM/DMARC, and Mail Queues

Account activation links, password recovery tokens, Private Message alerts, and watched-thread reply notifications are the lifeblood of MyBB member retention. Yet countless forum administrators leave Mail Handler configured to default PHP mail()—sending unauthenticated emails directly from a shared VPS IP address lacking reverse DNS, SPF, DKIM, or DMARC alignment. The inevitable result is catastrophic: Gmail, Microsoft Outlook, and Yahoo silently drop activation emails into spam or reject them at the SMTP gateway, stranding hundreds of legitimate new registrants who never verify their accounts, while viral thread replies stall PHP workers behind synchronous SMTP handshakes. By routing outbound mail through dedicated transactional relays, publishing strict DNS cryptographic authentication, tuning mybb_mailqueue batching, and automating bounce suppression, administrators achieve 99.8% primary-inbox placement.



Why Default PHP mail() Destroys Forum Onboarding and Retention

When MyBB invokes PHP’s native mail() function, your web server attempts to deliver messages directly from your origin web host’s IP address via local Sendmail or Postfix. In 2026, major mailbox providers enforce strict bulk-sender authentication requirements that make bare VPS mail delivery virtually impossible:
  • Dirty IP Neighborhoods & Missing PTR Records: Cloud VPS IP ranges frequently inherit blacklisted reputations from prior tenants and lack matching forward-confirmed reverse DNS (PTR) records—triggering immediate 550 5.7.1 rejections at Gmail and Outlook.
  • Synchronous SMTP Blocking on Busy Threads: If a popular discussion thread has 180 subscribed members and someone posts a reply, unqueued synchronous SMTP calls force the replier’s browser to hang for 15–30 seconds while PHP negotiates 180 sequential TLS handshakes.
  • Silent Hard-Bounce Reputation Decay: Without automated bounce feedback loops, MyBB continues dispatching thread notifications to abandoned or mistyped email addresses indefinitely—causing mailbox providers to classify your entire forum domain as an unsolicited spammer.

Cryptographic DNS Authentication Blueprint: SPF, DKIM, and DMARC

Before connecting MyBB to an external transactional relay (such as Amazon SES, Postmark, Mailgun, or Brevo), establish cryptographic sender identity on a dedicated notification subdomain—such as mail.forum.example.com—so transactional forum notifications never endanger your primary corporate email domain reputation:

[table]
[tr]
[td]DNS Record Type[/td]
[td]Host / Name[/td]
[td]Purpose & Alignment Role[/td]
[td]Recommended Production Policy[/td]
[/tr]
[tr]
[td]SPF (TXT)[/td]
[td]mail.forum.example.com[/td]
[td]Authorizes specific relay IP ranges to send on behalf of your bounce domain[/td]
[td]Strict hard-fail -all qualifier with fewer than 10 DNS lookups[/td]
[/tr]
[tr]
[td]DKIM (CNAME / TXT)[/td]
[td]s1._domainkey.forum.example.com[/td]
[td]Signs every outbound email header & body with a 2048-bit RSA/Ed25519 key[/td]
[td]2048-bit key minimum; rotate selector keys semi-annually[/td]
[/tr]
[tr]
[td]DMARC (TXT)[/td]
[td]_dmarc.forum.example.com[/td]
[td]Enforces alignment between visible From: header and SPF/DKIM signatures[/td]
[td]Start p=none to audit XML reports, then enforce p=quarantine / p=reject[/td]
[/tr]
[tr]
[td]Custom Return-Path (MX / CNAME)[/td]
[td]bounces.forum.example.com[/td]
[td]Captures asynchronous DSN hard bounces for automated suppression[/td]
[td]Aligned subdomain matching your From: root domain[/td]
[/tr]
[/table]

Here is a clean, production-hardened DNS zone example using a dedicated notification subdomain and enforced DMARC alignment:

Kod:
; DNS Records for Dedicated MyBB Transactional Subdomain (forum.example.com)
mail.forum.example.com.        300  IN  TXT   "v=spf1 include:amazonses.com -all"
ses1._domainkey.forum.example.com. 300 IN CNAME ses1.dkim.amazonses.com.
ses2._domainkey.forum.example.com. 300 IN CNAME ses2.dkim.amazonses.com.
_dmarc.forum.example.com.      300  IN  TXT   "v=DMARC1; p=reject; sp=reject; adkim=s; aspf=s; rua=mailto:dmarc-agg@example.com; pct=100"
Alıntı:Always send MyBB forum notifications from a dedicated subdomain (noreply@forum.example.com) with strict DKIM/SPF alignment—isolating high-volume community notification traffic from your core organizational email domain.

Configuring MyBB SMTP Mail Handler and Connection Encryption

Inside Admin CP - Configuration - Settings - Mail Settings, switch Mail Handler from PHP mail to SMTP mail and configure TLS-encrypted submission over port 587 (STARTTLS) or port 465 (implicit TLS):

  1. Explicit Return-Path and Admin Email Alignment: Set Admin Email to noreply@forum.example.com and configure Return-Path Email on the exact same domain so SPF alignment passes under strict DMARC (aspf=s) checks.
  2. Disable Message-ID Hostname Leaks: Verify that MyBB’s inc/mailhandlers/smtp.php generates clean Message-ID headers referencing @forum.example.com rather than revealing internal private server hostnames like ip-10-0-1-42.ec2.internal—which SpamAssassin rules penalize heavily.
  3. Enable Mail Logging During Initial Cutover: Temporarily set Mail Logging to Log everything for 48 hours while monitoring Admin CP - Tools & Maintenance - System Mail Log to catch TLS certificate mismatches or relay rate-limit errors immediately, then switch back to Log only errors to prevent mybb_maillogs database bloat.

Taming mybb_mailqueue: Asynchronous Batching and Rate-Limit Protection

When a thread attracts hundreds of subscribers—or when an administrator dispatches a community-wide Mass Mail announcement—MyBB inserts pending messages into mybb_mailqueue instead of blocking user HTTP requests. However, MyBB’s default task scheduler triggers /inc/tasks/sendmailqueue.php only when visitors browse pages, processing small batches erratically.

To guarantee instantaneous account activation emails while preventing large notification bursts from exceeding your SMTP provider’s per-second rate limits:

Kod:
<?php
// Custom Hook: Priority Bypass for Immediate Transactional Emails (Activation & Password Reset)
// Hook into 'my_mail_pre_build_message' to force $queue_override = false on critical auth emails
function mybb_prioritize_auth_emails(array &$mailData): void
{
    global $mybb;

    $criticalActions = ['register', 'lostpw', 'resendactivation', 'changeemail'];
    $currentAction = $mybb->get_input('action', MyBB::INPUT_STRING);

    if (THIS_SCRIPT === 'member.php' && in_array($currentAction, $criticalActions, true)) {
        // Bypass mybb_mailqueue so activation/reset links dispatch within <500ms
        $mailData['queue_override'] = false;
    }
}
Pair that priority bypass with a dedicated system cron job running every minute (* * * * * php /var/www/mybb/task.php) and tune Number of messages to send per batch inside Mail Settings to match your relay’s throughput quota (for example, 50 emails per minute on starter SES tiers or 250 emails per minute on production tiers).

Automated Bounce Handling, List-Unsubscribe Headers, and Inbox Hygiene

Modern inbox providers—especially Gmail and Yahoo—require one-click unsubscribe headers on automated bulk/subscription notifications and penalize senders whose hard-bounce rate exceeds 2%:
  • Injecting RFC 8058 List-Unsubscribe Headers: Extend my_mail_pre_send on watched-thread and mass-mail notifications to include List-Unsubscribe: <https://forum.example.com/usercp.php?action=removesubscriptions&key=...> alongside List-Unsubscribe-Post: List-Unsubscribe=One-Click—letting members unsubscribe cleanly inside their email client instead of clicking the destructive "Report Spam" button.
  • Webhook-Driven Hard Bounce Suppression: Configure your SMTP relay (Amazon SES SNS or Postmark Bounce Webhook) to POST hard-bounce JSON events to a signed MyBB endpoint that automatically disables email notifications (allownotices = 0, subscriptionmethod = 0) on affected mybb_users records—protecting your sender score automatically without manual cleanup.

By combining dedicated subdomain isolation, strict SPF/DKIM/DMARC alignment, priority-bypassed authentication emails, system-cron mybb_mailqueue batching, and automated bounce suppression, MyBB administrators ensure every new registrant and active contributor receives timely, primary-inbox notifications reliably.