voronkovich / wordpress-mailer-dsn
WordPress plugin to configure wp_mail() via MAILER_DSN environment variable.
Installs: 318
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 2
Forks: 2
Open Issues: 0
Type:wordpress-muplugin
pkg:composer/voronkovich/wordpress-mailer-dsn
Requires
- phpmailer/phpmailer: ^6.8.0
README
WordPress plugin to configure wp_mail() via MAILER_DSN environment variable.
Installation
Use the Composer:
composer require popartdesign/wordpress-mailer-dsn
Don't forget to activate the plugin, if you don't use the mu-plugins directory.
Define (in your .env file for example) the MAILER_DSN variable like this:
MAILER_DSN='mail://localhost'
Configuraton
Supported protocols:
mailsendmailqmailsmtpsmtps
Additional configuration could be applied via query string:
MAILER_DSN='mail://localhost?XMailer=SuperMailer&FromName=CoolSite'
PHPMailer configured by public properties, so you can use any of them. All allowed options could be found at PHPMailer Docs.
Examples
Sendmail
MAILER_DSN='sendmail://localhost?Sendmail=/usr/sbin/sendmail%20-oi%20-t'
SMTP
MAILER_DSN='smtp://user:password@localhost?SMTPDebug=3&Timeout=1000'
Gmail
MAILER_DSN='smtps://user@gmail.com:password@smtp.gmail.com:587'
Advanced
Sometimes it's not convinient to configure all options by the only one MAILER_DSN variable. For example, if you want to configure DKIM, you will end with very long unreadable DSN string. In this cases you can use one of MAILER_* variables:
MAILER_DEBUGMAILER_DEBUG_OUTPUTMAILER_FROMMAILER_FROM_NAMEMAILER_SENDERMAILER_DKIM_PRIVATEMAILER_DKIM_PASSPHRASEMAILER_DKIM_SELECTORMAILER_DKIM_IDENTITYMAILER_DKIM_DOMAIN- and etc.
See source code for all available vars.
License
Copyright (c) Voronkovich Oleg. Distributed under the MIT.