Stop Webform mail based on condition

Public

Warning message

We recommend you to assign at least one category to this snippet so you could easily navigate it in the future. Edit your snippet here.
</> CopyGet raw version
php
  1. function MODULE_mail_alter(&$message) {
  2. //You can do your conditional check here and depending on that
  3. //you can set the value of $message['send'] to false to stop the mail from being sent.
  4. //place the line below inside conditional loop, or else it'll stop every mail from being sent ;-)
  5. $message['send'] = FALSE;
  6. }