1

We are using SMTP Authentication module. Our SMTP provider claims we are whitelisted. Configuration works. When Drupal is supposed to send email, proper entry appears in Watchdog, claiming succesful sending.

Sadly, these days only 2 kinds of email ever arrive to our users: "Account disabled" and "Account deleted" notifications, and SMTP Authentication module test email. Password restore mails, email confirmation ones, user awaiting moderator's approval etc does not.

How can we log actual communication with SMTP server and have it stored for future reference? Now we don't know if we have to look for a bug in Drupal, or is it SMTP server's fault. With real data, we could tell for sure, and fix / have fixed the part that really needs it.

Enabling "debug" in SMTP Authentication is not practical - it debugs to screen, so it breaks AJAX calls and most of these emails are password recovery or new user ones, so they are triggered by anonymous - who obviously will not see debug data.

  • I guess the simple answer is change the SMTP module to output debugging to watchdog, in addition to/instead of to the screen. Unless it offers some hook to do that you'll need to patch the module temporarily, but for debugging a live server you don't really have another option (certainly not an easier one that I can think of, anyway). Usual advice would be "get it reproduced on dev, then you relax devel permissions temporarily for anon users to test", but with emails, getting problems reproduced is often hit and miss between different servers – Clive Aug 5 '14 at 14:42
  • @Clive as usual - I just hoped there is some switch I'm missing, or logging module I simply failed to find. Too bad it was not the case. Turns out it usually isn't, but I keep believing :/ And no, on dev it works all right. And we can't switch SMTP provider on production - not without some kind of proof that it is SMTP provider's fault. Security policies and all that - we literally are not able to, it's blocked on a server room level AFAIK. – Mołot Aug 5 '14 at 14:44
  • @Clive if hacking SMTP Auth module is the only option, or at least you believe so, put that as an answer. Don't bother with code, I can do that, I think. But if I'll upvote, my question will at least disappear from "unanswered" list. Or I could delete it, but I don't want to close my eyes to the possibility that there is someone who knows a better way. – Mołot Aug 5 '14 at 14:59
  • 1
    I've put one in...I wonder if this would be a good candidate for a feature request to the module (or even a patch if you implement it)? Sounds like something it should definitely be able to do – Clive Aug 5 '14 at 17:55
  • @Clive drupal.org/node/2316305 Sadly, it seems that current "debug" is done in library, and library does not know about Drupal and it's database, so it may be a bit more complicated than it seems. – Mołot Aug 6 '14 at 8:18
2

I guess a simple answer would be to change the SMTP module's debugging output to use the watchdog, in addition to/instead of to the screen.

Unless the module offers a hook to do that you'll probably need to patch it temporarily, but if you need to debug on the live server you don't really have another option (not an easier one that I can think of, anyway).

The usual advice would be "get it reproduced on dev, then relax devel permissions temporarily for anon users to test", but of course with emails, getting problems reproduced is often hit and miss between different servers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.