forked from Automattic/vip-go-mu-plugins-built
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vip-mail.php
33 lines (25 loc) · 779 Bytes
/
vip-mail.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
/*
Plugin Name: VIP Mail
Description: Routes mail via Automattic mail servers
Author: Automattic
Version: 1.0
License: GPL version 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/
class VIP_SMTP {
function init() {
add_action( 'phpmailer_init', array( $this, 'phpmailer_init' ) );
add_action( 'bp_phpmailer_init', array( $this, 'phpmailer_init' ) );
}
function phpmailer_init( $phpmailer ) {
global $all_smtp_servers;
$phpmailer->isSMTP();
$phpmailer->Sender = "[email protected]";
if ( ! is_array( $all_smtp_servers ) || empty( $all_smtp_servers ) )
return;
if ( count( $all_smtp_servers ) > 1 )
shuffle( $all_smtp_servers );
$phpmailer->Host = current( $all_smtp_servers );
}
}
( new VIP_SMTP() )->init();