Stop Webform mail based on condition


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.

Get raw version
  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. }