OJS 3.1 not sending any email [solved]

I’ve installed OJS 3.1 and configured Gmail as smtp, but the system can not send emails.
can someone help-me?
configuration as below:
//============================================================//
config.inc.php - [email]

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

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

; Enable SMTP authentication
; Supported mechanisms: ssl, tls
smtp_auth = ssl
smtp_username = "xxxx.xxx@gmail.com"
smtp_password = “xxxxxxxxxxxxx”

; Allow envelope sender to be specified
; (may not be possible with some server configurations)
; allow_envelope_sender = Off

; Default envelope sender to use if none is specified elsewhere
; default_envelope_sender = my_address@my_host.com

; Force the default envelope sender (if present)
; This is useful if setting up a site-wide noreply address
; The reply-to field will be set with the reply-to or from address.
; force_default_envelope_sender = Off

; Amount of time required between attempts to send non-editorial emails
; in seconds. This can be used to help prevent email relaying via OJS.
time_between_emails = 3600

; Maximum number of recipients that can be included in a single email
; (either as To:, Cc:, or Bcc: addresses) for a non-priveleged user
max_recipients = 10

; If enabled, email addresses must be validated before login is possible.
require_validation = Off

; Maximum number of days before an unvalidated account expires and is deleted
validation_timeout = 14
//============================================================//
|OS platform |Linux|
|PHP version |5.5.12-2ubuntu4|
|Apache version |Apache/2.4.10 (Ubuntu)|
|Database driver |mysql|
|Database server version |5.5.40-0ubuntu1|
//============================================================//
|force_ssl |Off|
|force_login_ssl |Off|
|session_check_ip |On|
|encryption |sha1|
|salt |YouMustSetASecretKeyHere!!|
|api_key_secret ||
|reset_seconds |7200|
|allowed_html |a[href|target|title],em,strong,cite,code,ul,ol,li[class],dl,dt,dd,b,i,u,img[src|alt],sup,sub,br,p|
//============================================================//
PHPinfo - http://ijcl.ufc.br/index.php/index/admin/phpinfo

sendmail_from no value
sendmail_path /usr/sbin/sendmail -t -i

Hi @falexandremc

When you attempt use Gmail as your SMTP sender it is required that you grant access to your webapp in Gmail service. Have you did it already?

It is likely that in your gmail account provided as sender you received some Gmail warnings about granting this privilege. Please take a look and proceed with their instructions to do so.

Regards,
Israel Cefrin
Public Knowledge Project Team

Boa tarde Israel. Muito brigado pela resposta. estou aqui pesquisando e achei vários links mas não sei se estou no caminho certo. onde eu posso conceder essa autorização?
e o web app em questão que precisa de permissão seria o SEER/OJS?
//================================================================
Good afternoon, Israel. thank-you for the answer. I’m here researching and i just found several links but I do not know if I’m on the right path. Where can I grant this authorization?
and the web app in question that needs permission would be SEER / OJS?

https://developers.google.com/gmail/api/auth/web-server


https://console.developers.google.com/flows/enableapi?apiid=gmail&credential=client_key
https://developers.google.com/apps-script/guides/services/authorization
https://developers.google.com/identity/protocols/OAuth2
https://myaccount.google.com/u/0/security

Ola @falexandremc

Quando tentas mandar mensagegs através de um aplicativo web (como o OJS) um email utilizando o Gmail como serviço de SMTP a conta em questão receberá um aviso onde será mostrado como autorizar o envio através do serviço dele.
//================================================================
At moment you attempt sending email messages through Gmail with your OJS (or any web app) you will receive in such account a warning and instructions how to proceed and grant sender privileges to your app uses their SMTP service.

Regards,
Israel Cefrin
Public Knowledge Project Team

Hi @falexandremc

This is google account you need access with gmail account you are using to send emails:

https://myaccount.google.com/
Sign to google > Sign-in and Security > Connected apps and sites

Here then you will need grant access to your OJS url domain/app.

Hope it helps.

Regards,
Israel Cefrin
Public Knowledge Project Team

Boa noite Israel. eu ativei a seguinte opção
//==============
God night Israel i just activate the following option


antes essa opção estava desativada.
//==============
before this option was deactivate

e quando entro na seguinte tela “Sign to google > Sign-in and Security > Connected apps and sites” não há nenhuma solicitação e nem aparece nada do tipo quando crio um novo anuncio que deveria mandar um email para as pessoas cadastradas (3 contas cadastradas no momento).
//==============
and when i enter on the following page “Sign to google > Sign-in and Security > Connected apps and sites” there are no solicitations and neither appear nothing like it when i create a new announcement what should send a email for the people registered(3 accounts registered at the moment).

everything works just fine except the communication between OJS and the registered users. www.ijcl.ufc.br
@israel.cefrin @asmecher @ctgraham

Hi @falexandremc

Have you attempted send an email through OJS again? If not, please do it and check your inbox in gmail account.

Regards,
Israel Cefrin
Public Knowledge Project Team

hi @israel.cefrin
i just attempt to make a new submission and create a new announcement and no emails was send. I even turn on the debug setting to see if some error would appear but nothing happen. I am very confuse because in OJS 3.0 emails works fine without the smtp config and in this server neither smtp or local Sendmail works

I found the error.log on/var/log/apache2/error.log
I empty the log and tried to create a announcement what should send a email and here is the log

Connection: opening, referer: http://www.ijcl.ufc.br/index.php/aprendizagemcooperativa/management/settings/website
SMTP ERROR: Failed to connect to server: php_network_getaddresses: getaddrinfo failed: Name or service not known (0), referer: http://www.ijcl.ufc.br/index.php/aprendizagemcooperativa/management/settings/website
SMTP connect() failed., referer: http://www.ijcl.ufc.br/index.php/aprendizagemcooperativa/management/settings/website
SMTP connect() failed., referer: http://www.ijcl.ufc.br/index.php/aprendizagemcooperativa/management/settings/website
Connection: opening, referer: http://www.ijcl.ufc.br/index.php/aprendizagemcooperativa/management/settings/website
SMTP ERROR: Failed to connect to server: php_network_getaddresses: getaddrinfo failed: Name or service not known (0), referer: http://www.ijcl.ufc.br/index.php/aprendizagemcooperativa/management/settings/website
SMTP connect() failed., referer: http://www.ijcl.ufc.br/index.php/aprendizagemcooperativa/management/settings/website
SMTP connect() failed., referer: http://www.ijcl.ufc.br/index.php/aprendizagemcooperativa/management/settings/website
Connection: opening, referer: http://www.ijcl.ufc.br/index.php/aprendizagemcooperativa/management/settings/website
SMTP ERROR: Failed to connect to server: php_network_getaddresses: getaddrinfo failed: Name or service not known (0), referer: http://www.ijcl.ufc.br/index.php/aprendizagemcooperativa/management/settings/website
SMTP connect() failed., referer: http://www.ijcl.ufc.br/index.php/aprendizagemcooperativa/management/settings/website
SMTP connect() failed., referer: http://www.ijcl.ufc.br/index.php/aprendizagemcooperativa/management/settings/website

I also deactivate smtp to see the log and I just found out that sendmail is not installed

Total size: 99462 Max size: 25600000, referer: http://www.ijcl.ufc.br/plugins/generic/tinymce/plugins/justboil.me/dialog-v4.htm
Total size: 160265 Max size: 25600000, referer: http://www.ijcl.ufc.br/plugins/generic/tinymce/plugins/justboil.me/dialog-v4.htm
sh: 1: /usr/sbin/sendmail: not found
Could not instantiate mail function., referer: http://www.ijcl.ufc.br/index.php/aprendizagemcooperativa/management/settings/website
sh: 1: /usr/sbin/sendmail: not found
Could not instantiate mail function., referer: http://www.ijcl.ufc.br/index.php/aprendizagemcooperativa/management/settings/website
sh: 1: /usr/sbin/sendmail: not found
Could not instantiate mail function., referer: http://www.ijcl.ufc.br/index.php/aprendizagemcooperativa/management/settings/website

@asmecher can u help me?

Hi @falexandremc,

The message…

 SMTP ERROR: Failed to connect to server: php_network_getaddresses: getaddrinfo failed: Name or service not known (0)

…suggests that the SMTP server you entered in your configuration file does not exist or your server cannot see it.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher

you mean this address?


I am trying right now to use the new version ojs-3.1.0-1 to see if i have better luck. if i have a different error log on this version I post here.

i just tryed to create a new user what should send a welcome email but this time i am making this on my own server on my computer whit the same smtp configuration and here is the PHP_error_log

PHP Warning: include(C:\xampp\htdocs\ojs-3.1.0-1\cache\t_compile\46fa2a4d1c2dfdfb7e296f4a3f7227463c634e62^%%B5^B5A^B5A5842A%%dashboardMenuItem.tpl.php): failed to open stream: Permission denied in C:\xampp\htdocs\ojs-3.1.0-1\lib\pkp\lib\vendor\smarty\smarty\libs\Smarty.class.php on line 1264

PHP Warning: include(): Failed opening ‘C:\xampp\htdocs\ojs-3.1.0-1\cache\t_compile\46fa2a4d1c2dfdfb7e296f4a3f7227463c634e62^%%B5^B5A^B5A5842A%%dashboardMenuItem.tpl.php’ for inclusion (include_path=’.;C:\xampp\htdocs\ojs-3.1.0-1/classes;C:\xampp\htdocs\ojs-3.1.0-1/pages;C:\xampp\htdocs\ojs-3.1.0-1/lib/pkp;C:\xampp\htdocs\ojs-3.1.0-1/lib/pkp/classes;C:\xampp\htdocs\ojs-3.1.0-1/lib/pkp/pages;C:\xampp\htdocs\ojs-3.1.0-1/lib/pkp/lib/adodb;C:\xampp\htdocs\ojs-3.1.0-1/lib/pkp/lib/phputf8;C:\xampp\htdocs\ojs-3.1.0-1/lib/pkp/lib/pqp/classes;C:\xampp\htdocs\ojs-3.1.0-1/lib/pkp/lib/smarty;C:\xampp\php\PEAR’) in C:\xampp\htdocs\ojs-3.1.0-1\lib\pkp\lib\vendor\smarty\smarty\libs\Smarty.class.php on line 1264

Connection: opening

SMTP ERROR: Failed to connect to server: (0)

SMTP connect() failed.

SMTP connect() failed.

I am trying to use smtp without ssl
with port 587 and i got some errors with information that seems useful. some one see those error before?

Connection: opening

Connection: opened

SERVER -> CLIENT:

CLIENT -> SERVER: EHLO localhost

SERVER -> CLIENT:

SMTP ERROR: EHLO command failed:

CLIENT -> SERVER: HELO localhost

SERVER -> CLIENT: 421 Cannot connect to SMTP server 64.233.190.108 (64.233.190.108:587), connect error 10060

SMTP ERROR: HELO command failed: 421 Cannot connect to SMTP server 64.233.190.108 (64.233.190.108:587), connect error 10060

CLIENT -> SERVER: MAIL FROM:ijcl.ufc@gmail.com

PHP Notice: fwrite(): send of 32 bytes failed with errno=10054 Foi for�ado o cancelamento de uma conex�o existente pelo host remoto.

in C:\xampp\htdocs\ojs-3.1.0-1\lib\pkp\lib\vendor\phpmailer\phpmailer\class.smtp.php on line 782

SERVER -> CLIENT:

SMTP ERROR: MAIL FROM command failed:

The following From address failed: ijcl.ufc@gmail.com : MAIL FROM command failed,

The following From address failed: ijcl.ufc@gmail.com : MAIL FROM command failed,

SMTP NOTICE: EOF caught while checking if connected

Connection: closed

Connection: opening

Connection: opened

SERVER -> CLIENT: 220 smtp.gmail.com ESMTP o5sm8859366qtc.72 - gsmtp

CLIENT -> SERVER: EHLO localhost

SERVER -> CLIENT: 250-smtp.gmail.com at your service, [my ip]

250-SIZE 35882577

250-8BITMIME

250-STARTTLS

250-ENHANCEDSTATUSCODES

250-PIPELINING

250 SMTPUTF8

CLIENT -> SERVER: MAIL FROM:ijcl.ufc@gmail.com

SERVER -> CLIENT: 530 5.7.0 Must issue a STARTTLS command first. o5sm8859366qtc.72 - gsmtp

SMTP ERROR: MAIL FROM command failed: 530 5.7.0 Must issue a STARTTLS command first. o5sm8859366qtc.72 - gsmtp

The following From address failed: ijcl.ufc@gmail.com : MAIL FROM command failed,530,5.7.0 Must issue a STARTTLS command first. o5sm8859366qtc.72 - gsmtp

The following From address failed: ijcl.ufc@gmail.com : MAIL FROM command failed,530,5.7.0 Must issue a STARTTLS command first. o5sm8859366qtc.72 - gsmtp

CLIENT -> SERVER: QUIT

SERVER -> CLIENT: 221 2.0.0 closing connection o5sm8859366qtc.72 - gsmtp

Connection: closed

Hi @falexandremc

This error is reporting you a security protocol they are requiring (and failing).

Are you using SSL or TLS in your config.inc.php? Please check it and try alternate to test.

Regards,
Israel Cefrin
Public Knowledge Project Team

I just solve the problem.
I added open DNS to the system configuration and now everything is working fine.
before i was solving the domains with the host archives on /etc. buts it was not enought.
the open DNS server solve the problem.

1 Like

Dear All
Hi,

I have faced this problem recently. No email is sending in any stage (new user registration, email to reviewer and …). My OJS version is 3.1.0.1 and it has been updated about 3 month ago and this error has been occurs about a week.
I have tried different mail services such as gmail and my own host mail service but non of them works. Also I have contact my host provider to check their services for bugs or other stuffs and they told me our services are working functionally.

Only this error is shown in error log: SMTP connect() failed.

Any suggestion?

Thanks a lot

Hi @MJB

How do you config your SMTP on config file?

Dear @Frosty, thanks for your reply

For gmail is:

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

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

; Enable SMTP authentication
; Supported mechanisms: ssl, tls
 smtp_auth = ssl
 smtp_username = username
 smtp_password =  PASS

I have also tried different ports and auth types but non of them works for gmail. I have also tried my own host mail server which was working previously.

2 Likes

how did you do that exactly?

We have such problem. SMTP connect() failed We configed own mail server
ojs 2 work but ojs 3 occur error.
I think ojs 3 config problem
ojs3 > smtp_auth = ssl , tls
ojs 2 > smtp_auth = PLAIN,LOGIN,…

1 Like