Skip to content

SMTP, DSN, XOAUTH2 & DKIM

WireMailPHPMailer supports every modern transactional email authentication and signing protocol through WireMailPHPMailerConfig (TabTransport and TabDKIM).

1. Compact smtp:// and smtps:// DSN Configuration

Section titled “1. Compact smtp:// and smtps:// DSN Configuration”

In TabTransport, enter a single write-only dsn string instead of filling individual host/port/user/password fields:

smtps://bookings%40aegeanvoyages.example:[email protected]:465
smtp://user:[email protected]:587?encryption=tls&timeout=15
  • Only smtp and smtps schemes are accepted.
  • Query parameters are validated against an explicit allowlist.
  • Always URL-encode @ or special characters in usernames/passwords.

2. XOAUTH2 Authentication (Totoglu\WireMailPHPMailer\OAuthProvider)

Section titled “2. XOAUTH2 Authentication (Totoglu\WireMailPHPMailer\OAuthProvider)”

For providers that deprecate static SMTP passwords, OAuthProvider (a backed string enum) ships first-class XOAUTH2 support:

Enum Case Value Required Composer Package Notes
OAuthProvider::Google 'google' league/oauth2-google Requires client ID, client secret, and refresh token
OAuthProvider::Microsoft 'microsoft' stevenmaguire/oauth2-microsoft Requires client ID, client secret, and refresh token
OAuthProvider::Azure 'azure' greew/oauth2-azure-provider clientSecret is optional (hasRequiredCredentials())
OAuthProvider::Yahoo 'yahoo' hayageek/oauth2-yahoo Requires client ID, client secret, and refresh token

Inspect provider installation and readiness in PHP:

use Totoglu\WireMailPHPMailer\OAuthProvider;
$provider = OAuthProvider::Google;
if ($provider->isInstalled() && $provider->hasRequiredCredentials($clientId, $clientSecret)) {
$client = $provider->createProvider($configArray);
}

Improve inbox placement and pass DMARC alignment by configuring DKIM signing in TabDKIM:

  • Domain (DKIM_domain): Sending domain (e.g., aegeanvoyages.example).
  • Selector (DKIM_selector): DNS TXT selector published at {selector}._domainkey.{domain}.
  • Private Key (DKIM_private_string or key file) & Passphrase (DKIM_passphrase): Stored write-only and masked in the admin form.

Next steps