OJS 3.0.2 does not send mails (PHP Mail function)

Good afternoon,

We are going to enter soon in publishing mode and we have detected that OJS 3.0.2 does not sent notifications of any type by mail.

We do not use any server SMTP or external, we simply need that the basic function PHP Mail() works. I have checked that the config archive of OJS has this option disabled (default).

The server has sendmail installed and it is able to send mails from command line:

echo “This is a test mail.” | mail -s Testing name@mail.com

Thanks.

Hi @Ayax,

I’d suggest checking your server’s mail delivery logs to see whether/why the messages are being rejected. This should be logged.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher

/var/log/mail.log

Sep  7 10:09:01 ########## sm-mta[14894]: v87D91sk014894: from=<root@##########.com>, size=881, class=0, nrcpts=1, msgid=<201709071309.v87D913M014893@##########.com>, proto=ESMTP, daemon=MTA-v4, relay=##########.com [127.0.0.1]
Sep  7 10:09:01 ########## sendmail[14893]: v87D913M014893: to=root, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30623, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (v87D91sk014894 Message accepted for delivery)
Sep  7 10:09:01 ########## sm-mta[14895]: v87D91sk014894: to=<root@##########.com>, ctladdr=<root@##########.com> (0/0), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31102, dsn=2.0.0, stat=Sent
Sep  7 10:39:01 ########## sendmail[14949]: v87Dd1Em014949: from=root, size=623, class=0, nrcpts=1, msgid=<201709071339.v87Dd1Em014949@##########.com>, relay=root@localhost
Sep  7 10:39:02 ########## sm-mta[14950]: v87Dd1WG014950: from=<root@##########.com>, size=881, class=0, nrcpts=1, msgid=<201709071339.v87Dd1Em014949@##########.com>, proto=ESMTP, daemon=MTA-v4, relay=##########.com [127.0.0.1]
Sep  7 10:39:02 ########## sendmail[14949]: v87Dd1Em014949: to=root, ctladdr=root (0/0), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=30623, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (v87Dd1WG014950 Message accepted for delivery)
Sep  7 10:39:02 ########## sm-mta[14951]: v87Dd1WG014950: to=<root@##########.com>, ctladdr=<root@##########.com> (0/0), delay=00:00:01, xdelay=00:00:00, mailer=local, pri=31102, dsn=2.0.0, stat=Sent
Sep  7 11:09:01 ########## sendmail[15031]: v87E914p015031: from=root, size=623, class=0, nrcpts=1, msgid=<201709071409.v87E914p015031@##########.com>, relay=root@localhost
Sep  7 11:09:01 ########## sm-mta[15032]: v87E91BB015032: from=<root@##########.com>, size=881, class=0, nrcpts=1, msgid=<201709071409.v87E914p015031@##########.com>, proto=ESMTP, daemon=MTA-v4, relay=##########.com [127.0.0.1]
Sep  7 11:09:01 ########## sendmail[15031]: v87E914p015031: to=root, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30623, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (v87E91BB015032 Message accepted for delivery)
Sep  7 11:09:01 ########## sm-mta[15033]: v87E91BB015032: to=<root@##########.com>, ctladdr=<root@##########.com> (0/0), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31102, dsn=2.0.0, stat=Sent
Sep  7 11:39:01 ########## sendmail[15237]: v87Ed15x015237: from=root, size=623, class=0, nrcpts=1, msgid=<201709071439.v87Ed15x015237@##########.com>, relay=root@localhost
Sep  7 11:39:01 ########## sm-mta[15238]: v87Ed1fw015238: from=<root@##########.com>, size=881, class=0, nrcpts=1, msgid=<201709071439.v87Ed15x015237@##########.com>, proto=ESMTP, daemon=MTA-v4, relay=##########.com [127.0.0.1]
Sep  7 11:39:01 ########## sendmail[15237]: v87Ed15x015237: to=root, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30623, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (v87Ed1fw015238 Message accepted for delivery)
Sep  7 11:39:01 ########## sm-mta[15239]: v87Ed1fw015238: to=<root@##########.com>, ctladdr=<root@##########.com> (0/0), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31102, dsn=2.0.0, stat=Sent
Sep  7 12:09:01 ########## sendmail[15309]: v87F91mT015309: from=root, size=623, class=0, nrcpts=1, msgid=<201709071509.v87F91mT015309@##########.com>, relay=root@localhost
Sep  7 12:09:01 ########## sm-mta[15310]: v87F91lH015310: from=<root@##########.com>, size=881, class=0, nrcpts=1, msgid=<201709071509.v87F91mT015309@##########.com>, proto=ESMTP, daemon=MTA-v4, relay=##########.com [127.0.0.1]
Sep  7 12:09:01 ########## sendmail[15309]: v87F91mT015309: to=root, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30623, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (v87F91lH015310 Message accepted for delivery)
Sep  7 12:09:01 ########## sm-mta[15311]: v87F91lH015310: to=<root@##########.com>, ctladdr=<root@##########.com> (0/0), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31102, dsn=2.0.0, stat=Sent

“stat=Sent”
But no email received in the inbox or spam folder

Hi @Ayax,

I would suggest capturing one of the messages that’s being sent, headers and all, and testing your local mail delivery outside of OJS. The best way to capture a message’s complete details is probably to add some logging to the PHPMailer class; see the mailPassthru function in lib/pkp/lib/vendor/phpmailer/phpmailer/class.phpmailer.php.

Regards,
Alec Smecher
Public Knowledge Project Team

Thank you, but I do not know how to add the logging to function mailPassthru…

EDIT: OJS3 support Exim as replacement of Sendmail?

Hi @Ayax,

When you have SMTP disabled, OJS will use PHP’s mail function for delivery via a local MTA. My understanding is that this function will use Exim or Sendmail equally, whichever is on the system.

Regards,
Alec Smecher
Public Knowledge Project Team

I had a similar issue due to my new server configurations.

If you are in a new Linux distro with SELinux, you should check if apache has permission to send mails and network connection.

Summarizing, this issue was solved for me, under RHEL 7 (some distros refer to apache as apache) with:
$ sudo setsebool -P httpd_can_sendmail 1
$ sudo setsebool -P httpd_can_network_connect 1

Thank you, but I have Ubuntu without SELinux…

EDIT: Exim does not work either

We experience the same problem and we solved using same email as admin as journal contact email.
For example:
Admin Email: ojs@yourdomain.com
Journal Contact Email: ojs@yourdomain.com

Regards,

Hi @asmecher,

I have got same problem with OJS 3.1.1.4. This version does not send mails. Authors, reviewers don`t receive any notifications or direct mails.
How to solve this problem?

Regards,
Lazar

Hi @Lazar_Stosic,

See this suggestion above.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher ,
I am not sure if I can understand all above. I looked in mailPassthru function in lib/pkp/lib/vendor/phpmailer/phpmailer/class.phpmailer.php and have>

private function mailPassthru($to, $subject, $body, $header, $params)
{
//Check overloading of mail function to avoid double-encoding
if (ini_get(‘mbstring.func_overload’) & 1) {
$subject = $this->secureHeader($subject);
} else {
$subject = $this->encodeHeader($this->secureHeader($subject));
}

    //Can't use additional_parameters in safe_mode, calling mail() with null params breaks
    //@link http://php.net/manual/en/function.mail.php
    if (ini_get('safe_mode') or !$this->UseSendmailOptions or is_null($params)) {
        $result = @mail($to, $subject, $body, $header);
    } else {
        $result = @mail($to, $subject, $body, $header, $params);
    }
    return $result;
} 

What concrete I can do?

Hi @Lazar_Stosic,

Have you checked your mail delivery logs?

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher ,
I contacted my provider. They checked all from their side.
In log file have>

019-01-20 19:05:07 1glHSv-00Bi1k-Ku U=ijcadsee Warning: “SpamAssassin as cpaneleximscanner detected OUTGOIN
G not smtp message as NOT spam (-95.3/60)”
2019-01-20 19:05:07 1glHSv-00Bi1k-Ku <= ijcadsee@cpanel11.beotel.net U=ijcadsee P=local S=2865 id=b4a1426c33
5c2a077935212a63181fbc@www.ijcrsee.com T="[ijcrsee] New notification from International Journal of Cognitive
Research in Science, Engineering " for lazarstosic@yahoo.com
2019-01-20 19:05:07 cwd=/var/spool/exim 3 args: /usr/sbin/exim -Mc 1glHSv-00Bi1k-Ku
2019-01-20 19:05:07 1glHSv-00Bi1k-Ku Sender identification U=ijcadsee D=ijcrsee.com S=ijcadsee
2019-01-20 19:05:07 1glHSv-00Bi1k-Ku SMTP connection outbound 1548007507 1glHSv-00Bi1k-Ku ijcrsee.com lazars
tosic@yahoo.com
2019-01-20 19:05:10 1glHSv-00Bi1k-Ku => lazarstosic@yahoo.com R=dkim_lookuphost T=dkim_remote_smtp H=mta7.am
0.yahoodns.net [98.136.102.54] X=TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128 CV=yes C=“250 ok dirdel”
2019-01-20 19:05:10 1glHSv-00Bi1k-Ku Completed

2019-01-21 03:36:54 1glPSC-00E4FT-Fx SMTP connection identification D=ijcrsee.com O=editor@ijcrsee.com E=laz
arstosic@yahoo.com M=1glPSC-00E4FT-Fx U=ijcadsee ID=3160 B=redirect_resolver
2019-01-21 03:36:54 1glPSC-00E4FT-Fx Sender identification U=ijcadsee D=ijcrsee.com S=editor@ijcrsee.com
2019-01-21 03:36:54 1glPSC-00E4FT-Fx SMTP connection outbound 1548038214 1glPSC-00E4FT-Fx ijcrsee.com lazars
tosic@yahoo.com
2019-01-21 03:36:54 1glPSC-00E4FT-Fx => editor (editor@ijcrsee.com) R=virtual_user T=do
vecot_virtual_delivery C=“250 2.0.0 UA2fMEYwRVxAKzMAAt7AqA Saved”
2019-01-21 03:36:54 1glPSC-00E4FT-Fx => editor R=archive_incoming_email_domain_method T
=archiver_incoming_domain_method
2019-01-21 03:36:58 1glPSC-00E4FT-Fx => lazarstosic@yahoo.com (editor@ijcrsee.com, editor@ijcrsee.com) or@ijcrsee.com> R=dkim_lookuphost T=dkim_remote_smtp H=mta5.am0.yahoodns.net [67.195.228.141] X=TLSv1.2:ECDH
E-RSA-AES128-GCM-SHA256:128 CV=yes C=“250 ok dirdel”

  • there are some e-mails that are not delivered for something else, for example:

2019-01-20 08:42:19 1gl7kD-008ck3-Tn U=ijcadsee Warning: “SpamAssassin as cpaneleximscanner detected OUTGOIN
G not smtp message as NOT spam (-93.7/60)”
2019-01-20 08:42:19 1gl7kD-008ck3-Tn <= ijcadsee@cpanel11.beotel.net U=ijcadsee P=local S=2987 id=b316a13b52
49fa90ee43114c20299d12@www.ijcrsee.com T="[ijcrsee] New notification from International Journal of Cognitive
Research in Science, Engineering " for shamionov@mail.ru
2019-01-20 08:42:19 cwd=/var/spool/exim 3 args: /usr/sbin/exim -Mc 1gl7kD-008ck3-Tn
2019-01-20 08:42:19 1gl7kD-008ck3-Tn Sender identification U=ijcadsee D=ijcrsee.com S=ijcadsee
2019-01-20 08:42:19 1gl7kD-008ck3-Tn SMTP connection outbound 1547970139 1gl7kD-008ck3-Tn ijcrsee.com shamio
nov@mail.ru
2019-01-20 08:42:21 1gl7kD-008ck3-Tn ** shamionov@mail.ru R=dkim_lookuphost T=dkim_remote_smtp H=mxs.mail.ru
[94.100.180.31] X=TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256 CV=yes: SMTP error from remote mail server after
end of data: 550 5.7.1 This message was not accepted due to domain (yahoo.com) owner DMARC policy (RFC 7489)
https://help.mail.ru/mail-help/postmaster/dmarc

Any idea where can find the problem?

Regards,
Lazar

Hi @Lazar_Stosic,

The one rejection I see is the bottom of the log:

end of data: 550 5.7.1 This message was not accepted due to domain (yahoo.com) owner DMARC policy (RFC 7489)

I’d suggest searching this forum and the issue tracker for more information on DMARC.

Regards,
Alec Smecher
Public Knowledge Project Team

Dear,

I communicated with our provider. They checked all and from their side is everything OK. In Track Delivery I found that for message which I sent receive next error>
Delivery%20event%20details

This is not only for gmail addresses. All mails have this type of error. Any idea? Earlier I didn`t setup nothing in mail account and everything work very well. Now, suddenly stop working.

Regards,
Lazar

Dear @Lazar_Stosic
Is the problem solved?
I found a similar problem with my Ojs 3.1.1.4

Dear @kawahyu

I still wait some proposal. I tried everything, communicated with my provider but everything is OK with their server. Something comes wrong in OJS. Everything working and suddenly stooped. If I solve this problem, as always, I will write solution here in the post.

Regards,
Lazar

I have consulted with my server provider and did some trial. The outgoing mails are working back normally when sending the notification (Notify) to authors. The solution is ‘a bit weird’ so far I think.

image image.png

I have that in my error log. The server provider staff suggested me to make email, name@jurnalbeta.ac.id. It refers to the domain’s name. I also change my email contact similar to the suggested one, name@jurnalbeta.ac.id

Then change email setting as follows in config.inc.php

; Use SMTP for sending mail instead of mail()
smtp = On

; SMTP server settings
smtp_server = name of hosting server
smtp_port = 465

; Enable SMTP authentication
; Supported mechanisms: ssl, tls
smtp_auth = ssl
smtp_username = “name@jurnalbeta.ac.id”
smtp_password = “password for above email”

This is not weird. You are now using SMTP instead of PHP Mail. SMTP is way better and under security.

1 Like