Pass return-path additional parameter in wp_mail


Our server is currently automatically setting the return path as {serverusername@serverhostname.tld}. When sending an email in PHP, I can override this by doing the following:

$return = '<bounce@domain.tld>';
$additional = "-f$return";
mail($to,$subject,$message,$headers, $additional);

My problem is that WordPress doesn’t offer the functionality to add additional_parameters like the native PHP Mail function does. Is there a workaround to get this working? Here’s the actual code that my WordPress plugin is using to send the email:

$headers = array(
    'From: Eden Mobility <>',
    'Content-Type: text/html; charset=UTF-8',
    'Return-Path: <>'
wp_mail( "", 'Your ' . $item . ' renewal is almost due', $template, $headers ); // LIVE

One thing I have noticed is that I’m now getting warnings when submitting mail:

PHP Warning: escapeshellcmd() has been disabled for security reasons in /home/user/ on line 1442
[02-Feb-2018 15:25:54 UTC]

Liam McArthur 4 months 0 Answers 16 views 0

Leave an answer