Cannot send email from OJS 2.4.8.1

Hello OJS community,

We’re a publisher of medical journals from Indonesia. Currently we’re having a problem sending email on OJS. Previously it was worked like a charm and running well for months, but yesterday it just stopped working. We have contacted our hosting company, just in case they changed the email service port or anything like that, but the service had nothing change.

For the information, we have been applying force_default_envelope_sender shown in this link pkp/pkp-lib#1723: force_default_envelope_sender moves the traditional from to a reply-to for DMARC compliance by ctgraham · Pull Request #1724 · pkp/pkp-lib · GitHub.

This is the error message and the stacktrace we got:

There was an error sending this email. Please check your mail log (/var/log/maillog).
Stack Trace:
File: /home/u1231757/public_html/lib/pkp/classes/mail/PKPMailTemplate.inc.php line 237
Function: Mail->send()

File: /home/u1231757/public_html/classes/mail/MailTemplate.inc.php line 163
Function: PKPMailTemplate->send(False)

File: /home/u1231757/public_html/classes/mail/ArticleMailTemplate.inc.php line 66
Function: MailTemplate->send(False)

File: /home/u1231757/public_html/pages/user/EmailHandler.inc.php line 155
Function: ArticleMailTemplate->send(Object(Request))

File: (unknown) line (unknown)
Function: EmailHandler->email(Array(0), Object(Request))

File: /home/u1231757/public_html/lib/pkp/classes/core/PKPRouter.inc.php line 362
Function: call_user_func(Array(2), Array(0), Object(Request))

File: /home/u1231757/public_html/lib/pkp/classes/core/PKPPageRouter.inc.php line 220
Function: PKPRouter->_authorizeInitializeAndCallRequest(Array(2), Object(Request), Array(0), False)

File: /home/u1231757/public_html/lib/pkp/classes/core/Dispatcher.inc.php line 134
Function: PKPPageRouter->route(Object(Request))

File: /home/u1231757/public_html/lib/pkp/classes/core/PKPApplication.inc.php line 178
Function: Dispatcher->dispatch(Object(Request))

File: /home/u1231757/public_html/index.php line 64
Function: PKPApplication->execute()

We also get this email sending failure notification which categorize our email as spam:

A message that you sent was rejected by the local scanning code that
checks incoming messages on this system. The following error was given:

This message was classified as SPAM and may not be delivered

------ This is a copy of your message, including all the headers.
------ No more than 100K characters of the body are included.

Received: from u123 by hoster.com with local (Exim 4.87)
(envelope-from <enquiry@ourdomain.org>)
id 1cDiDU-002nXV-9q
for n
@hotmail.com; Mon, 05 Dec 2016 08:37:16 +0700
To: "N
" n*****@hotmail.com
Subject: [PI] Article Review Request
X-PHP-Script: ourdomain.org/index.php for 36.70.8.98
X-PHP-Filename: /home/u123
***
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=“==boundary_663a205c881ef1e9078b423d52a3fb7c”
Return-Path: enquiry@*ourdomain.org
From: enquiry@ourdomain.org
X-Mailer: Public Knowledge Project Suite v2
X-Originating-IP: 36.70.8.98
Date: Mon, 05 Dec 2016 01:37:16 +0000
Reply-To: "Dr
" k****@gmail.com
Message-Id: <E1cDiDU-002nXV-9q@
.com>
Sender: <u123@****hoster.com>

This message is in MIME format and requires a MIME-capable mail client to view.

–==boundary_663a205c881ef1e9078b423d52a3fb7c
Content-Type: text/plain; charset=utf-8

N******:

I believe that you would serve as an excellent reviewer of the manuscript,

What should we do? Thank you very much for the advise and the attention given.

with best regards,
Sisca

Hello,

if nothing has changed with the system and it suddenly started to flag your messages as spam you should check that your domain hasn’t been blacklisted from service like http://rbls.org/

Edit: Actually that IP in X-Originating-IP that you forgot to censor out is in three black lists:
cbl.abuseat.org, xbl.spamhaus.org and sbl-xbl.spamhaus.org
Could be that, but it doesn’t seem like those are that strong lists. Does some email go through or is it just certain email providers?

Hello @WaDelma,

Thank you very much for the kind advise. I checked our domains against the links you gave and found that we’re not blaclisted. As for the x-originating ip, it is our dynamic ip from ISP.

We just found that this problem is intermittent with failure sending happens much much more often (spam classified). It affects all emails sent from OJS (submission ack, rejection) regardless of the domain.

What could possibly wrong? Thanks a heap for your help.

with best regards,
sisca

More details of who is rejecting the message and why are probably in your mail log:

This rejection is almost certainly happening at your hosting company, but details the mail log would clarify.

Some things to consider in why your messages might be flagged as spam are described here:

Hello @ctgraham Thanks so much for your help. I was kind of overwhelmed following the solution at Github. I’m slowly digesting it.

From what I got from the mail log, it showed that the spam trap happening several times before it finally delivered the email.

From email header, I see that SPF fail might be the culprit. Oddly that’s an email account created under my domain.

Delivered-To: @gmail.com
Received: by 10.80.139.100 with SMTP id l91csp96581edl;
Tue, 6 Dec 2016 19:24:43 -0800 (PST)
X-Received: by 10.194.119.68 with SMTP id ks4mr55089578wjb.171.1481081083741;
Tue, 06 Dec 2016 19:24:43 -0800 (PST)
Return-Path: en***@paediatricaindonesiana.org
Received: from mx12-14.smtp.antispamcloud.com (mx12-14.smtp.antispamcloud.com. [46.165.232.184])
by mx.google.com with ESMTPS id c2si22613057wjm.95.2016.12.06.19.24.43
for ***@gmail.com
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Tue, 06 Dec 2016 19:24:43 -0800 (PST)
Received-SPF: fail (google.com: domain of en
@paediatricaindonesiana.org does not designate 46.165.232.184 as permitted sender) client-ip=46.165.232.184;
Authentication-Results: mx.google.com;
dkim=pass header.i=@paediatricaindonesiana.org;
spf=fail (google.com: domain of en***@paediatricaindonesiana.org does not designate 46.165.232.184 as permitted sender) smtp.mailfrom=en***@paediatricaindonesiana.org

This is strange because I have already applied this #1723 (DMARC comply) and worked well before that spam problem occurs.

What do you think? Many thanks in advance.

Good debugging.

Resolving the SPF problem is an action for someone who administers your DNS. The way SPF works is that a special TXT record is added to the DNS for your domain, indicating what servers are permitted to send mail on behalf of that domain.

Your domain currently has an SPF record, but it does not allow the IP of 46.165.232.184:

paediatricaindonesiana.org		TXT	v=spf1 +a +mx +ip4:156.67.210.201 +ip4:156.67.210.202 +mx:mx.google.com +mx:saripediatri.org +mx:srv21.niagahoster.com +ip4:156.67.210.213 -all

If mail should be coming from 46.165.232.184, allow this in your SPF record. If mail should not be coming from 46.165.232.184, check your config.inc.php or mailserver configuration. You may be routing your mail through an unexpected smtp service.