Return Path management on wp_mail function
-
Probably since the latest version of included php-mailer library I got some issue with return path header on emails. I’m used to add a return-path header to get back the bounces on specific mailboxes.
The return-path header is overwritten by many mail server if not passed, on unix, with -f command line parameter.
Php-mailer does it only if the Sender variable is set, it does not check if there is a return-path header. So, plugins that add such header are not granted that it will be respected.
To solve this “issue”, wp_mail can check the headers (as already done to extract from and fromname), look for a return-path header and use it’s value to set the phpmailer Sender value.
Otherwise plugin should add a filter on phpmailer which is a lot more complex.
Patch to pluggable.php file is (for version 3.3.1):
switch ( strtolower( $name ) ) { case 'return-path': $return_path = trim($content); break; case 'from': if ( strpos($content, '<' ) !== false ) { @@ -308,6 +311,10 @@ if ( !isset( $from_name ) ) $from_name = 'WordPress'; if (!empty($return_path)) { $phpmailer->Sender = $return_path; }
what do you think? I tested it on a couple of servers with exim and postfix… some shared hosting have not that problem since they extract and “respect” the return path.
Bye, Stefano.
- The topic ‘Return Path management on wp_mail function’ is closed to new replies.