Some time ago our site got blocked outgoing e-mails (by the webhosting provider, due to spam issues), and so I discovered that Drupal's user and conatct modules are not checking for the return value of mail() function (via user_mail() alias drupal_mail() ) The resulting situation might be almost described as critical, because users were happily registering, but receiving no mails, then sending complaints via site-wide contact form, and no reply. All lost due to mail() failing, and watchdog-logs perfectly clean.

This was on 4.7.3, so I silently patched the modules, and assumed I can't say more, because we're not up-to-date with Drupal 5. But now, upgrading to 5.1, I see that the situation is exactly the same on 5.1. Note that in the requesting-new-password functionality, the code is OK.

Steps to reproduce:
--- Drupal 5.1 or 4.7.3 (and possibly others?), normal public user-registration with e-mail.
--- Configure your php or mail software, so that mail() returns FALSE (not sure how exactly, but I'm 100% sure that the return was FALSE in our case)
--- Register a new user.

Expected behaviour:
--- Error message to watchdog logs, and to the user.

What happened instead:
--- User got a green message, that e-mail was sent
--- Watchdog got no error/warning entry at all.

Solution proposal:
--- Take the success-check from request-new-password case, and include similar checks to all the places where e-mails are sent.
--- Alternative: Add error-logging to the drupal_mail() if possible.

Patch:
--- Attaching my patch currently used on live site, but this is badly incomplete, as there are other occurences of mail-sending, that we don't need (= can't test on live site).
--- Needs work.

(I'll submit an isuue for contact.module separately)

CommentFileSizeAuthor
user-mail.patch1.35 KBJirkaRybka

Comments

JirkaRybka’s picture

The Issue I created for contact.module is here: http://drupal.org/node/159094

I'm submitting this almost-duplicate issue to keep track of the problem for both the modules, if maintained separately. If you disagree, feel free to mark one of my issues as Duplicate.

JirkaRybka’s picture

Status: Needs work » Closed (duplicate)

Marking as duplicate, my new Issue for 6.x here: http://drupal.org/node/169627