Mandrill maintains a "Rejection blacklist" of email address for which mail sending fails. When this happens the mandrill module, in mandrill_mailsend():
1) logs the events in watchdog e.g. "Failed sending email from site@example.co.uk to you@hotmail.co.uk. rejected: no message". (The "no message" is added by the Drupal module because no reason message is returned by mandrill. )
2) Returns TRUE, thus telling the sending process that the mail was sent successfully, which is untrue in this case.
A similar flow would occur for sends resulting in "error" or "invalid" status.
The mandrill module should tell the sending process that the mail failed so that it can queue the mail for sending on another occasion if necessary.
Items on the blacklist expire after a certain time - from a week to a year. It would be useful to know this info so that the calling process could decide whether to retry the mail in a week or give up.
More info on blacklists at http://help.mandrill.com/entries/22880521-What-is-a-rejected-email-Rejec...
Comments
Comment #1
hughworm CreditAttribution: hughworm commentedComment #2
JordanMagnuson CreditAttribution: JordanMagnuson commentedIt would also be nice to have a hook invoked whenever an email is rejected by Mandrill, so that other modules can act on the event and decide to, for example, delete the user account.
Comment #3
nbchip CreditAttribution: nbchip commentedAdding hook (mandrill_message_result?) to mandrill.module Line 151 would allow us to react on message status and also use message _id, which i would like to store in my DB (for possible message threading reasons)
Comment #4
nbchip CreditAttribution: nbchip commentedSendgrid module does something similar
module_invoke_all('sendgrid_integration_sent', $message['to'], $result->code, $smtp_api['unique_args'], $result_data);
Also adding failed messages to queue for resending seems as a good idea from sendgrid module
Comment #5
levelos CreditAttribution: levelos commentedI'm on board with the hook and returning FALSE in the case of an error. Ref. 975a014.
Comment #9
Martijn Houtman CreditAttribution: Martijn Houtman commentedJust a quick question: when an email address is blacklisted, Drupal displays an error to the user. I really want to prevent this in case of 'rejected'. This hook uses module_invoke_all(), which does not allow any altering, nor can the hook return a value. This means we can not change the behaviour, e.g. ignoring the error by returning TRUE in the hook.
Any idea how to deal with this?