How can I customize
drupal_mail() error messages? I 've switched off the display of error messages, but this config does not seem to affect to the management of email messages, which insists on displaying the status of the delivery in the navigator screen.
drupal_set_message() to push error messages on mail failure. The only way to suppress those messages is by altering
drupal_set_message() output. Depending on the how/why, there's a couple of tacts to take.
One way to do this is a blanket suppression via the Disable Messages module that lets suppress messages based on a few different criteria.
Gives a site owner options to disable specific messages shown to end users. The core drupal message system as offered by drupal_set_message is an excellent way for modules to send out messages to the end users. However not all drupal site owners are keen to show all the messages sent out by drupal core and all modules to their users. This module gives site administrators a reasonably powerful way to filter out messages shown to the end users.
Another, more surgical way, is to manipulate the
$_SESSION['messages'] variable which contains the array of pending messages to render, following the execution of