-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy path_core-mail.php
37 lines (34 loc) · 844 Bytes
/
_core-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
34
35
36
37
<?php
/*
* Plugin Name: Mail settings
* Plugin URI: https://github.com/szepeviktor/wordpress-website-lifecycle
*/
// Remove X-Mailer header from emails.
add_action(
'phpmailer_init',
static function ($phpmailer) {
$phpmailer->XMailer = ' ';
},
10,
1
);
// Log mail sending errors.
add_action(
'wp_mail_failed',
static function ($error) {
if (! is_wp_error($error)) {
error_log('WordPress core failure: not an instance of WP_Error in "wp_mail_failed"');
return;
}
$message = sprintf(
'Mail sending error: [%s] %s',
$error->get_error_code(),
$error->get_error_message()
);
error_log($message);
openlog('php-fpm', LOG_PID, LOG_LOCAL0);
syslog(LOG_ALERT, $message);
},
-1,
1
);