OJS 3.0.1 is not sending any emails

I have a new installation of OJS 3.0.1. I am new to OJS so I apologize if my question is simple. I log in as the manager and create a journal. I tell it to send email to my address but I never receive it. I am running on RHEL 7.3 and can send email via postfix and sendmail. When I try to send from OJS there is nothing in the maillog . in OJS in the classes/mail folder there are only 2 php files. Is that correct.
Also, is there an easier way to test sending mail from OJS.

Hi @smithmich,

It sounds like smtp is set to Off in your config.inc.php. That should use your local MTA (e.g. Sendmail), which in turn should cause something to get logged in your server’s email sending log.

In any case, we use the PHPMailer library, which is invoked in lib/pkp/classes/mail/Mail.inc.php in the send function. I’d suggest putting some debugging output there to help debug.

Alec Smecher
Public Knowledge Project Team

Thanks, I reinstalled and it works now. Using the PHPMailer.and the SMTP Mail Settings.


I have OJS3 installed, sending Emails does not work, I tried to use the SMTP=on but still does not work, can you please give me the exact configuration to use, its like one week I am stuck here and I can not progress.

Using SMTP will require a configuration including an SMTP server, and probably a username and password, all of which will be specific to your account with your mail service provider. Check with your provider’s support for the appropriate SMTP settings.

I did contact my G suite support and they provide me those configurations, as well we did some configuration in G suite SMTP relay service but hopeless does not work, it seems there is problem with OJS it self

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

; SMTP server settings
smtp_server = smtp.gmail.com
smtp_port = 587

; Enable SMTP authentication
smtp_auth = TLS
smtp_username = “username”
smtp_password = “password”

Have you also tried the suggested Gmail settings published here?

To check whether you are running into a system error, or whether you are running into an OJS error, check your PHP error log for more details. You might also want to test PHPMailer itself with a test script using your desired settings:

1 Like

Dear #ctgraham

I check all the logs , nothing related to Emailing or SMTP configuration, Can you assist me through skype or google hangout to fix the problem together, I am afaid if I can not solve the problem by this week, I have to move to another platform for my journal

I can’t personally offer skype or hangouts debugging. What I can do is try to replicate this problem locally to help you know what to look for. I’ll try to do that, and let you know what I find.

Have you tried smtp_auth = tls ? It is quite possible that PHPMailer’s SMTPSecure option is case sensitive.

I’ve also confirmed that there is a bug in the code which allows errors in sending mail to fail to log any error messages.

Thank you for your help,
I did try as well tls, ssl, plain authentification, and port : 25,465, 587 also I did try the server names: smtp.gmail.com / mail.spu.edu.iq / mail.google.com

I am not sure where is the problem or what kind of error I need to look for?! is it OJS problem or Server problem

If you are comfortable with PHP, try patching lib/pkp/classes/mail/Mail.inc.php with the changes here:

You will then see the error messages in your error log.

For best results (most detail), enable the option show_stacktrace = On in your config.inc.php.

I did what you suggest and I got the following error:

[06-Apr-2017 06:22:22 America/Denver] Connection: opening
[06-Apr-2017 06:22:24 America/Denver] SMTP ERROR: Failed to connect to server: Network is unreachable (101)
[06-Apr-2017 06:22:24 America/Denver] SMTP connect() failed.

This means that your server is unable to route to the smtp server you have specified in config.inc.php. Are you still using smtp.gmail.com? Is your server’s internet connection proxied?

I am using smtp.gmail.com with port 465 or 587 and my server is not proxied but everything is routed through G suite (Google)

If you have shell access to the server, or if you are comfortable testing things in PHP scripts, you could try a direct connection from the server to smtp.gmail.com to see where the breakdown is. I would check:

  • Does smtp.gmail.com resolve correctly? (Currently I get a CNAME of gmail-smtp-msa.l.google.com with addresses of : 2607:f8b0:400d:c0e::6d,, and
  • Can you get to just gmail.com on port 80? (Different host, but confirms external non-proxied access)
  • Can you get to smtp.gmail.com on port 587 via a low level tool like bash or telnet? (You don’t expect a valid SMTP request/response, just something other than a network error.)
  • Can you connect via SMTP to smtp.gmail.com:587 with a tool other than PHP/PHPMailer? (Maybe PHP itself is blocking the connection? Unlikely.)

Ultimately, this sounds like a server/host level error, and you will probably need to ask your system administrator or hosting support for resolution, but any of the above questions/answers will help them identify and correct the problem.

hello again,

I did all those steps and everything seems ok, and I connect connect using telnet through the port 587 ans smtp.gmail.com.

I am quiet sure that the problem is with my hostmonster, however they said it is not our problem its either OJS or Google

So any other suggestions ??

The message

strongly indicates a system or network level error, but if you are able to from a shell prompt, or from PHP, connect directly to smtp.gmail.com:587, that almost certainly rules out a system or network error.

Is that same error message still occuring in your tests? Do you get the same error message testing against mail.spu.edu.iq instead of against gmail, or does it change?

ok, I desactivate in config.inc.php the option SMTP and I am using phpmailer, so I can send email nows but the emails sent to all the type of emails except my domain emails which is so strange?? any idea?