Shortly: I needed to change the “sender” of all emails from a blog so every delivery error would have been sent to a specific mailbox. Without installing plugins, the three lines of code needed are:

add_action('phpmailer_init', function (PHPMailer $mailer) {
   $mailer->Sender = '';
}, 1000);

They can be added in the theme functions.php  file for example, even if I wouldn’t add a blog wide behavior in a theme.

My excuses for my bad english but it's the only way I have to communicate with you. Would you suggest a correction? Leave a comment, thank you!
Categories: WordPress


Leave a Reply