When I want to submit a form (webform module) I get get the followng error:

Call to undefined function Drupal\Core\Mail\Plugin\Mail\escapeshellcmd() in Drupal\Core\Mail\Plugin\Mail\PhpMail::_isShellSafe() (line 165 of core/lib/Drupal/Core/Mail/Plugin/Mail/PhpMail.php).

This error disappears if I remove all mails in "/admin/structure/webform/manage/MY-FORM/handlers".

This error occurs also using simplenews module by trying to subscribe to a newsletter.

1 Answer 1


escapeshellcmd() is a built-in PHP function, and should always be found. It evidently can't be found in the global namespace on your system, so PHP falls back to looking for it in the current namespace where it is being called, which is \Drupal\Core\Mail\Plugin\Mail\escapeshellcmd(). And obviously it won't be found there either, which is why you get the error.

Try php --info and search for the disable_functions setting to see if someone turned off use of escapeshellcmd() on your system. That seems the only likely possibility. Or better yet search for the disable_functions setting at /admin/reports/status/php since that will show the settings for the version of PHP that your webserver is using.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.