Skip to content
Snippets Groups Projects
Commit 238db394 authored by ale's avatar ale Committed by agata
Browse files

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 3f2b16e5
No related merge requests found
<?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;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment