$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>wp mail - Why do WordPress emails to multiple recipients include n in the list|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

wp mail - Why do WordPress emails to multiple recipients include n in the list

matteradmin11PV0评论

All emails from WordPress are not going to multiple emails for some reason. They have been entered in separated by commas. However when I check the mail log the recipient list is like this:

[email protected],\[email protected]

Is there any way to stop this?

All emails from WordPress are not going to multiple emails for some reason. They have been entered in separated by commas. However when I check the mail log the recipient list is like this:

[email protected],\[email protected]

Is there any way to stop this?

Share Improve this question edited Jan 16, 2019 at 13:04 butlerblog 5,1413 gold badges28 silver badges44 bronze badges asked Jan 15, 2019 at 6:41 MattGetmilkMattGetmilk 11 bronze badge 2
  • Are you taking email addresses from a textarea and putting the value directly into wp_mail? – Jacob Peattie Commented Jan 15, 2019 at 8:31
  • im simply using the woocommerce email settings to put the addresses in. for the life of me I cannot work out why it started doing this. its likely caused by a plugin, but will obviously need me to add some code somewhere to fix as all the plugins are required. Im no coder, but can arse my way around inserting some code with help from those that know a lot more than me. – MattGetmilk Commented Jan 16, 2019 at 2:07
Add a comment  | 

1 Answer 1

Reset to default 0

As you mentioned, it could be a plugin. Tracking that down would require deactivating other plugins and retesting to find out. Tracking down the actual problem is really what you need to do.

However, in absence of actually finding the problem, you may be able to filter out the new line indicator with the following filter (add it to your theme's functions.php):

add_filter( 'wp_mail', 'my_wp_mail_filter' );
function my_wp_mail_filter( $args ) {

    $args['to'] = str_replace( '\n', '', $args['to'] );

    return $args;
}

This should take the "to" address and run str_replace() to replace any instances of "\n" with an empty value.

Post a comment

comment list (0)

  1. No comments so far