Skip to content

Storing credentials in wp-config

Keep a connection's credentials out of the database with a BOOLEANSMTP_{DRIVER}_{KEY} constant in wp-config.php or your server environment.

Last updated View as MarkdownAsk ClaudeAsk ChatGPT

Every credential field a connection has can also be set from wp-config.php or your server’s environment instead of the database. A defined, non-empty constant always overrides the value stored for that field.

BOOLEANSMTP_{DRIVER}_{KEY}

— the connection’s driver, then the field’s key, both upper case.

A Custom SMTP connection’s SMTP Username and Password fields are username and password, so setting these in wp-config.php overrides them for every Custom SMTP connection on the site:

define('BOOLEANSMTP_SMTP_USERNAME', 'your-smtp-username');
define('BOOLEANSMTP_SMTP_PASSWORD', 'your-smtp-password');

On the connection form, choose Credential Storage: WP Config to read the constant from wp-config.php, or Environment to read it as an OS environment variable instead — either way, leave the field itself blank.

Don’t define a constant as an empty string — BooleanSMTP treats a defined-but-empty constant as present, and it overrides a value stored in the database.

See the full list of constants for every driver’s field names and the constants BooleanSMTP reads outside connection settings.