Skip to content

Early-bird lifetime licence: $199 once, for the first 200 buyers only. See the offer

Send email through your mail server (SMTP)

WordPress sends its emails through your mailbox’s SMTP server instead of the web server, so they arrive instead of landing in spam.

  • Type PHP
  • Runs Everywhere (runs as WordPress loads)
  • Category Email
  • Tested with WordPress 7.1

Before you switch it on: Add the four SNIPFIRE_SMTP_ lines to wp-config.php with your mailbox’s server, address, password and port.

It arrives switched off, even when you install its whole pack with "Switch on after installing".

PHP
<?php

// Put these lines in wp-config.php (not here), with your mailbox's details:
// define( 'SNIPFIRE_SMTP_HOST', 'smtp.example.com' );
// define( 'SNIPFIRE_SMTP_USER', 'hello@example.com' );
// define( 'SNIPFIRE_SMTP_PASS', 'your-password' );
// define( 'SNIPFIRE_SMTP_PORT', 465 );          // 465 = SSL, 587 = TLS
add_action(
	'phpmailer_init',
	static function ( $mailer ) {
		if ( ! defined( 'SNIPFIRE_SMTP_HOST' ) || ! defined( 'SNIPFIRE_SMTP_USER' ) || ! defined( 'SNIPFIRE_SMTP_PASS' ) ) {
			return;
		}
		$port = defined( 'SNIPFIRE_SMTP_PORT' ) ? (int) SNIPFIRE_SMTP_PORT : 465;
		$mailer->isSMTP();
		$mailer->Host       = SNIPFIRE_SMTP_HOST;
		$mailer->Port       = $port;
		$mailer->SMTPSecure = 465 === $port ? 'ssl' : 'tls';
		$mailer->SMTPAuth   = true;
		$mailer->Username   = SNIPFIRE_SMTP_USER;
		$mailer->Password   = SNIPFIRE_SMTP_PASS;
		$mailer->setFrom( SNIPFIRE_SMTP_USER, wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ), false );
	}
);

Good to know

The password stays in wp-config.php, not in the snippet. Until the lines are there, the snippet does nothing.

In these packs

  • Email: Emails from your name and address, sent through SMTP, and fewer notification emails.

Move your snippets over this afternoon.

Importing changes nothing until you switch over, and your old shortcodes keep working.