Download & Extend

Mail system messages on errors are confusing

Project:Drupal core
Version:7.x-dev
Component:mail system
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review

Issue Summary

We always assume that mail sends successfully, so when it fails, we give the user confusing messages.

drupal_mail() returns the $message with the send results in $message['result'], we should check this before displaying any message that says something like "Your mail has been sent". The assumption is that the underlying mail system displays it's own error message on failure. So, on failure, the underlying mail system might say "Your message has NOT been sent", and then Drupal comes over that and says "Your message has been sent." ... bad, confusing.

Would be nice to get some fix in quickly ... and then have further discussion about what is the right way of handling these failures.

AttachmentSizeStatusTest resultOperations
mail.patch7.37 KBIdlePASSED: [[SimpleTest]]: [MySQL] 21,943 pass(es).View details | Re-test

Comments

#1

Looks good to me, all the existing code looks like it either doesn't care, or assumes drupal_mail() will return NULL or FALSE on failure, which isn't the case.

#2

The assumption is that the underlying mail system displays it's own error message on failure. So, on failure, the underlying mail system might say "Your message has NOT been sent", and then Drupal comes over that and says "Your message has been sent." ... bad, confusing.

There is nothing in the drupal_mail() documentation that imply this behavior, and it would be really bad design anyway. If some alternative implementations of drupal_mail() do that, you should open a bug report against them.

For now we are just ignoring the error, which is not that bad given how unreliable mail distribution can be. I'm leaning toward "not a bug" here. We could decide to actually display an error when 'result' is FALSE, but in that case we should do that consistently in the caller function.

nobody click here