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 = 'bounce@domain.com';
}, 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.

Similar Posts

Leave a Reply