Problem with notifyUsers function

Hi,

OJS Version: 2.4.8.2
We are experiencing a problem with using the Notify Users function for a particular journal. Our email configuration is working in general and the Notify users function works as expected for other journals.
But for one journal, when trying to send the email, OJS briefly goes to the progress page, but no updates to the progress bar occur. There are no error messages.
In the apache logs, it seems there is an SMTP error code each time the notify Users function is tried.

[Tue Jun 06 10:41:51.335542 2017] [:error] [pid 2651] [client 62.214.78.162:58169] OJS SMTPMailer: Did not receive expected 250 or 251, referer: https://ejournals.bc.edu/ojs/index.php/ihe/editor/notifyUsers
[Wed Jun 07 16:49:57.650814 2017] [:error] [pid 27129] [client 136.167.205.201:43790] OJS SMTPMailer: Did not receive expected 250 or 251, referer: https://ejournals.bc.edu/ojs/index.php/nancy/editor/notifyUsers
[Thu Jun 08 02:08:26.405047 2017] [:error] [pid 51137] [client 62.96.251.245:50392] OJS SMTPMailer: Did not receive expected 250 or 251, referer: https://ejournals.bc.edu/ojs/index.php/ihe/editor/notifyUsers
[Thu Jun 08 02:13:13.708698 2017] [:error] [pid 51373] [client 62.96.251.245:50440] OJS SMTPMailer: Did not receive expected 250 or 251, referer: https://ejournals.bc.edu/ojs/index.php/ihe/editor/notifyUsers

Is it possible we are triggering a timeout or hitting an upper limit? There are more than 4800 users subscribed to the journal.

Any suggestions for how to troubleshoot further or things to look for in the SMTP logs would be appreciated.

thanks,
Luke Gaudreau
Boston College Libraries

Hi @lukegaudreau,

If message delivery is generally working, then your SMTP configuration according to OJS is correct. I suspect your mail server has some arbitrary limit that OJS is hitting, thus the server is rejecting them. The SMTP error logs should give you a more specific idea – look for timestamps that correspond to the same approximate time that OJS reports a delivery problem.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

I finally obtained a copy of the relevant log entries on our relay server. The emails that were not delivered were sent with zero recipients, an empty subject and a zero byte message. Also, even though the large number of recipients should have triggered multiple batches of emails to ten recipients at a time, only one email is attempted.

See the mail logs here

thanks,
Luke

Hi @lukegaudreau,

Hmm, this seems pretty atypical – the notifyUsers function is pretty broadly used, and I’ve never heard behavior like this reported. To verify whether the log entries correspond to nearly-empty messages being sent from OJS, I’d suggest capturing the message as it’s delivered to the server – e.g. by logging the mail data from the send function in lib/pkp/classes/mail/SMTPMailer.inc.php function, and inhibiting normal delivery so that you can test without accidentally spamming users.

Regards,
Alec Smecher
Public Knowledge Project Team

Thanks @asmecher,
Can you provide some guidance for how I might do this? Or point to information on debugging? Is there a standard logging mechanism I should use?
best,
Luke

Hi @lukegaudreau,

I would suggest using something like the PHP error_log mechanism. The relevant calls to SMTPMailer are in lib/pkp/classes/mail/Mail.inc.php. You’ll need a small amount of PHP proficiency to do this.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher
Thanks for the pointers. I was able to get some additional useful information logged. It looks to me like two things are happening:

  1. Our SMTP relay appears to be rejecting valid email addresses outside of bc.edu (see example smtp session)
  2. OJS appears to stop sending emails after the first rejection (see ssl_error_log)

I assume OJS should continue with subsequent recipients even when not receiving a 250 or 251, but it does not appear to when receiving a 550 here.
thanks,
Luke

Hi @lukegaudreau,

The notification tool sends emails in batches (e.g. 10 recipients per message), sending as many messages as necessary. If a message with 10 recipients is rejected, then none of those 10 will get it. Does that sound like what’s happening?

Regards,
Alec Smecher
Public Knowledge Project Team

No. It seems like once one rejection is received, OJS never moves on to the next batch of 10.

I was able to resolve the problem with our SMTP relay rejecting valid emails by having the new server’s IP registered for sending. But I’m still looking to understand and resolve the problem with rejections.

From what your saying it sounds like the expected behavior would be

  • For an email sent to 10 recipients
  • if recipient number 7 is rejected
  • none of the 10 recipients receive the email
  • OJS moves on with 11-20

But from my observations

  • Recipients 1-6 receive the email
  • OJS does not move on to 11-20

Hi @lukegaudreau,

Ah, I think I see the issue. I mis-remembered the details of this code. The email sending is not done in batches of 10 (or whatever) – the messages are sent individually. It’s the status update back to the UI that’s only occasionally reported.

SMTP sending will have “hard” and “soft” errors. Soft errors will result in the message typically not being delivered, but will not cause the process to stop. Hard errors, however, will cause the delivery to stop in its tracks. I suspect this is what you’re encountering.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,
Ok, that makes more sense. So, it looks like the 550 returned by our mail server is triggering the hard error. Is the only way around it to eliminate addresses that return a 550?
thanks,
Luke

Hi @lukegaudreau,

Yes, or to alter the way OJS handles error messages during SMTP sending. FYI, OJS 3.x uses a third-party library for SMTP Service (PHPMailer) rather than a homegrown one – among many things, it has better error handling. OJS 3.x doesn’t yet have good mass-mailing tools, but when those get added, they’ll be more robust than what OJS 2.x offers.

Regards,
Alec Smecher
Public Knowledge Project Team

We are having a similar issue where the notify users features keeps loading (progressing) but nothing is happenning. When all the other mail bulk email features works just fine. for exampe the send email tor registered users on all announcements works find.

We are using ojs 3.3.0.8

Where do you should we look in order to solve this issue? thank you