Commit 2daabaed authored by ale's avatar ale Committed by agata

Add ai-common plugin

Contains common functions, starting with one to set up PHPMailer
so that it uses an external SMTP server if desired.
parent 79845e0e
<?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;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment