From 642c1ee9cd9220e1807bf53fdae7cf7b6c07075f Mon Sep 17 00:00:00 2001 From: ale <ale@incal.net> Date: Thu, 23 Nov 2017 11:46:25 +0000 Subject: [PATCH] Add ai-common plugin Contains common functions, starting with one to set up PHPMailer so that it uses an external SMTP server if desired. --- wp-content/plugins/ai-common/functions.php | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 wp-content/plugins/ai-common/functions.php diff --git a/wp-content/plugins/ai-common/functions.php b/wp-content/plugins/ai-common/functions.php new file mode 100644 index 000000000..11b9fdee4 --- /dev/null +++ b/wp-content/plugins/ai-common/functions.php @@ -0,0 +1,33 @@ +<?php +/** + * Plugin Name: A/I Common Functions + * Plugin URI: https://noblogs.org + * Description: Custom functions used by Noblogs. + * Author: Autistici/Inventati + * Author URI: https://autistici.org + * Version: 1.0 + */ + +// Put your code snippets below this line. + +/** + * This function will connect wp_mail to a (possibly authenticated) + * external SMTP server, instead of using the PHP mail() function. + * + * Values are constants set in wp-config.php + */ +if (defined('SMTP_HOST')) { + add_action('phpmailer_init', 'send_smtp_email'); + function send_smtp_email($phpmailer) { + $phpmailer->isSMTP(); + $phpmailer->Host = SMTP_HOST; + $phpmailer->SMTPAuth = SMTP_AUTH; + $phpmailer->Port = SMTP_PORT; + $phpmailer->Username = SMTP_USER; + $phpmailer->Password = SMTP_PASS; + $phpmailer->SMTPSecure = SMTP_SECURE; + $phpmailer->From = SMTP_FROM; + $phpmailer->FromName = SMTP_NAME; + } +} + -- GitLab