Is it possible to abort sending of the e-mail somewhere in the middle of sending procedure? Mail sending is initiated in the depths of some third party module. There's a case when I need to intervenue and depending on some environment variables either let it through, or prevent it. How do I do that?

I've seen in the wild a weird technique of setting $message['to'] to + (what's logic behind this by the way?). But this generates an error in server logs.

Any ideas?
As reported in the documentation for hook_mail_alter(), you can avoid a message is sent by setting $message['send'] to FALSE. 


  Parameters
  
  
  $message: An array containing the message data. Keys in this array include:
  
  
  'id': The drupal_mail() id of the message. Look at module source code or drupal_mail() for possible id values.
  'to': The address or addresses the message will be sent to. The formatting of this string will be validated with the PHP e-mail validation filter.
  'from': The address the message will be marked as being from, which is either a custom address or the site-wide default email address.
  'subject': Subject of the email to be sent. This must not contain any newline characters, or the email may not be sent properly.
  'body': An array of strings containing the message text. The message body is created by concatenating the individual array strings into a single text string using "\n\n" as a separator.
  'headers': Associative array containing mail headers, such as From, Sender, MIME-Version, Content-Type, etc.
  'params': An array of optional parameters supplied by the caller of drupal_mail() that is used to build the message before hook_mail_alter() is invoked.
  'language': The language object used to build the message before hook_mail_alter() is invoked.
  'send': Set to FALSE to abort sending this email message.
  
  


At least, your code should check the value of $message['id'] which is a concatenation of the short name of the module and the key assigned to the message from the module.

function mymodule_mail_alter(&amp;$message) {
  if ($message['id'] == 'modulename_messagekey') {

    // Verify other conditions are true.

    $message['send'] = FALSE;
  }
}