-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwp-mailhog.php
executable file
·43 lines (34 loc) · 1.06 KB
/
wp-mailhog.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
34
35
36
37
38
39
40
41
42
43
<?php
/**
* @link
* @since 1.0.0
* @package TODO
*
* @wordpress-plugin
* Plugin Name: Use MailHog
* Description: Configure WordPress on Valet to use MailHog
* Version: 1.0.1
* Tags: local, email
*/
if( defined( 'WP_ENV' ) && WP_ENV !== 'production' ){
add_action( 'phpmailer_init', 'supermundano_configMH', 10, 1 );
}
function supermundano_configMH( $phpmailer ) {
// Define that we are sending with SMTP
$phpmailer->isSMTP();
// The hostname of the mailserver
$phpmailer->Host = 'localhost';
// Use SMTP authentication (true|false)
$phpmailer->SMTPAuth = false;
// SMTP port number
// Mailhog normally run on port 1025
$phpmailer->Port = WP_DEBUG ? '1025' : '25';
// Username to use for SMTP authentication
// $phpmailer->Username = 'yourusername';
// Password to use for SMTP authentication
// $phpmailer->Password = 'yourpassword';
// The encryption system to use - ssl (deprecated) or tls
// $phpmailer->SMTPSecure = 'tls';
$phpmailer->From = 'site_adm@wp.local';
$phpmailer->FromName = 'WP DEV';
}