Mail Notifications to disabled users

Dear PKP Devs, dear Alec.
I recently faced a problem in mail notifications sending (by SMTPMailer).
It happened that in a journal we have the account of an Author that is unfortunately dead and his email (of our local institution) was deleted.
Our SMTP server refuses mail sent to non existent local mailboxes,

Recipient address rejected: User unknown in local recipient table;

so the SMTPMailer fails with message

OJS SMTPMailer: Did not receive expected 250 or 251,

And the mailing stops here, causing the other recipients to not receive the mail.

As we don’t want to delete (merge) the user, now I have solved the problem using an intermediate SMTP server that is only forwarding the messages to the main SMTP server of our institution, but we tried also to disable the user, but that user keeps being included in the list of recipients of notifications.

I would suggest to modify the behaviour of OJS in order to exclude the disabled users from the list of recipients of the notification mailing.

Hi @netdiver,

I wonder about running into problems if we disable emails to these users everywhere – for example, a journal manager who is specificlaly communicating with a disabled account about the reasons for disabling it. What notifications are you finding are problematic? Beyond perhaps a bounce message, what effects are you dealing with?

Regards,
Alec Smecher
Public Knowledge Project Team

Dear Alec, thanks for your reply.
As I said in my message, this problem caused the interruption of mail
sending with the original configuration: if the SMTP server you are using
is configured to refuse the message if the local mailbox is nonexistent,
the entire mailing is aborted.
In my case OJS was sending a message to an invalidaddress@localdomain.it
using SMTP server of localdomain.it.
In this case there is not a bounce message to the sender, but there is a
refusal at the level of the SMTP transaction.
If this thing would be done with an email client, the mail would remain in
the outbox and an error would be displayed by the email client.
This is the entire log row for the SMTP error:

NOQUEUE: reject: RCPT from [IP address of ojs]: 550 5.1.1 <
invalidaddress@localdomain.it>: Recipient address rejected: User unknown in
local recipient table; from= to=<
invalidaddress@localdomain.it> proto=SMTP helo=

If the invalid email is the first of the queue, potentially nobody receives
any message.
A better solution could be to deal with the refusal message in the SMTP
transaction (550 code), trying to parse or capture the refusal message to
show it to the user and go on with other recipients of the list, instead of
aborting completely the SMTP transaction.
I think this should be done in MassMail class if I got it right, because
the callback of the function every 10 recipients acts only if the previous
SMTP transaction is successful.
Thanks for your support!

Hi @netdiver,

That answers my question – that you’re using MassMail to send this out. That’s only used when sending out notification emails as Editor (e.g. that a new issue was published). I think it would make a worthwhile change to that class specifically, and otherwise disabled users would continue to receive emails. Does that make sense?

Regards,
Alec Smecher
Public Knowledge Project Team

Yes Alec, I’m sorry for the lack of details given.
I was using the New issue notification function.
I tried to track the logical flow of notifyUsers function and saw that the MassMail class was used.
Then I found the exact message of the Apache Error Log in the SMTPMailer class (SMTPMailer.inc.php line 114).
When you are referring to “a worthwile change” are you referring to the handling of the 550 error (Requested action not taken: mailbox unavailable)?
If so, maybe it could be useful to take into account all the SMTP error codes of the 55x class:

550 Requested action not taken: mailbox unavailable
551 User not local; please try <forward-path>
552 Requested mail action aborted: exceeded storage allocation
553 Requested action not taken: mailbox name not allowed
554 Transaction failed

Thanks!
Best regards.
Lorenzo

Hi @netdiver,

What I mean is that disabled users should be excluded from mass mail-outs. See the issue and patch here:

If possible, could you try the attached patch (specifically https://github.com/asmecher/ojs/commit/9aabed0e4fb1d8c6dcf16fe6cf5fa588b40b6f9b.diff)? I havne’t committed it to our repo, but if it works for you, I can do that.

Thanks,
Alec Smecher
Public Knowledge Project Team

Thanks a lot for the patch Alec.
I would prefer to upgrade our OJS installation first, to the latest (2.4.6) version and then apply your patch.
Please give me some time to schedule this activity.

Dear Alec,
I finally applied the patch you sent, basically only a line added to pages/editor/IssueManagementHandler.inc.php
if ($recipients->getDisabled()) continue;

But now I obtain this error:
Call to undefined method DAOResultFactory::getDisabled() in /opt/ojs/pages/editor/IssueManagementHandler.inc.php on line 1084

Did I miss something?
Is the getDisabled method defined somewhere?

A quick guess would be that the line should be:

if ($recipient->getDisabled()) continue;
1 Like

Hi all,

Oops, @ctgraham is right. Try this instead:
https://github.com/pkp/ojs/commit/068995fe32604bda777111f96cc369d326b0c471.diff

Please confirm that it’s behaving as you expect and I’ll commit it.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

We tested the patch here at Lepidus and it is working well.

thanks,
Diego Abadan - Lepidus Tecnologia
PeriĂłdicos em Nuvens

Hi all,

Merged. Thanks for confirming, @abadan.

Regards,
Alec Smecher
Public Knowledge Project Team