Erro de envio de e-mail. SMTP

  • Versão do aplicativo - OJS 3.1.2.4

  • Descrição do problema

Cada vez que o sistema deve enviar e-mail de notificação aos autores aparece uma mensagem em vermelho no canto da tela informando que houve um problema e o e-mail não pode ser enviado (isto ocorre ao tentar informar que o artigo foi aceito ou rejeitada, qualquer mensagem direta ao autor foi escolhida).

  • Print

  • Mensagem de log de erro

[Mon Feb 08 14:20:22.969032 2021] [php7:notice] [pid 18690] [client 172.20.0.1:38290] SMTP connect() failed. Troubleshooting · PHPMailer/PHPMailer Wiki · GitHub, referer: https://periodicos.ufop.br:8082/pp/index.php/revemop/reviewer/submission/4723

Estamos executando os serviços do OJS em um contêiner Docker. Atualmente, não há configuração de e-mail específica no contêiner, já que o servidor SMTP é externo. Não há outra ocorrência de problemas de e-mail, apenas no sistema OJS.

@andersonvm,

provavelmente este problema é referente a problemas de configuração ou de conexão com servidor SMTP externo ao OJS.

Qual a configuração SMTP no OJS? o contêiner Docke consegue “enxergar” SMTP?

existe algum bloqueio no firewall? bloqueio de entrada/saída portas?!

Tem vários tópicos aqui no fórum que trás esse problema relacionado com SMTP.

Se puder fornecer mais detalhes.

Att,
Diego

Qual a configuração SMTP no OJS? o contêiner Docke consegue “enxergar” SMTP?

[email]

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

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

O que você quer dizer com o container do OJS “enxergar” o servidor SMTP? Se o container acessa ele pela rede?

existe algum bloqueio no firewall? bloqueio de entrada/saída portas?!

As portas em uso são as mesmas desde quando foi configurado inicialmente. Iniciamos na versão 2.4.6.0 e subimos para 2.4.8.5, como versão intermediária, para alcançar a versão 3. Hoje operamos em container Docker com a versão 3.1.2-4.

@andersonvm

O google solicita que você cadastre a aplicação para utilizar o SMTP deles. Provavelmente ainda não cadastraste essa sua app Docker/OJS e por isso ele rejeita conexão.

Veja no atual manual do OJS como resolver isso:
https://docs.pkp.sfu.ca/admin-guide/en/email#configuring-the-system-to-use-gmail-smtp

Abraços
Israel Cefrin
PKP Team

2 curtidas

Olá, @israelcefrin

Agradeço sua ajuda. Vou dar uma verificar nisso que você me informou.

Gostaria de saber também se você pode me ajudar com outra questão relativo a este tópico

Israel, estamos tendo problemas para configurar o SMTP do OJS com contas Microsoft Outlook 365.
Sabe se há alguma restrição da Microsoft ou se estamos deixando de realizar alguma validação?

Os dados em geral são:
[email]

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

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

; Enable SMTP authentication
; Supported mechanisms: ssl, tls
smtp_auth = tls
smtp_username = “email”
smtp_password = “senha”

Agradeço

Ola @OpenJournalSolutions

É preciso configurar alguns parâmetros a mais no arquivo config.inc.php para funcionar corretamente com o Office365.

allow_envelope_sender = On
default_envelope_sender = your_address@your_host.tld
force_default_envelope_sender = On
force_dmarc_compliant_from = On

Fonte: OJS 3 is not sending mail with the office365 SMTP settings - #7 by ctgraham - Software Support - PKP Community Forum

Abraços
Israel Cefrin
PKP Team

@israelcefrin, para configuração com o Gmail, utilizando o GSuit, tem alguma configuração específica que eu deva seguir?

Acredito que seja a criação e a autorização do aplicativo OJS como autorizado no seu painel do Google conforme fala no link mais acima que enviei.

Abraços
Israel Cefrin
PKP Team

Fiz isso, mas recebo erro de conexão mesmo com os dados corretos e as configurações também.

Erro: SMTP connect() failed. Troubleshooting · PHPMailer/PHPMailer Wiki · GitHub

Configuração:
; Use SMTP for sending mail instead of mail()
smtp = On

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

; Enable SMTP authentication
; Supported mechanisms: ssl, tls
smtp_auth = tentei ambos
smtp_user = “email”
smtp_password = “senha”

; Enable suppressing verification of SMTP certificate in PHPMailer
; Note: this is not recommended per PHPMailer documentation
smtp_suppress_cert_check = Off

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

; Default envelope sender to use if none is specified elsewhere
default_envelope_sender = email

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

; Force a DMARC compliant from header (RFC5322.From)
; If any of your users have email addresses in domains not under your control
; you may need to set this to be compliant with DMARC policies published by
; those 3rd party domains.
; Setting this will move the users address into the reply-to field and the
; from field wil be rewritten with the default_envelope_sender.
; To use this you must set force_default_enveloper_sender = On and
; default_envelope_sender must be set to a valid address in a domain you own.
force_dmarc_compliant_from = On

; The display name to use with a DMARC compliant from header
; By default the DMARC compliant from will have an empty name but this can
; be changed by adding a text here.
; You can use ‘%n’ to insert the users name from the original from header
; and ‘%s’ to insert the localized sitename.
dmarc_compliant_from_displayname = ‘%n via %s’

Olá

Acredito que sua versão de OJS possa estar com a mesma questão do usuário que comentou naquela mesma thread.

Ele teve de editar o arquivo /lib/pkp/classes/mail/Mail.inc.php e mostra o que ele fez para arrumar. Acredito que possa ser o seu caso também:

Abraços
Israel Cefrin
PKP Team

@israelcefrin, conseguimos resolver o problema.

O processo do Docker estava com algum problema que não permitia com que o contêiner comunicasse com a rede externa. Conseguíamos acessar o serviço, mas não comunicava corretamente com os outros serviços externos.
Vamos migrar para um servidor dedicado para este fim, para que a aplicação rode em ambiente separado.

Agradeço sua atenção e empenho para ajudar.

1 curtida

Infelizmente não é o caso. O email do admin é o mesmo usado no smtp. Estamos ficando sem opções. Vamos tentar alterar o mail.inc e ver o que conseguimos.

@andersonvm e @OpenJournalSolutions
Em breve teremos outro problema em relação ao processo de autenticação com o Google, que começará a bloquear o acesso de apps menos seguros a partir do 15 de fevereiro de 2021, e somente o método OAuth será permitido pelo mesmo.
Em breve irei testar uma nova solução para o nosso servidor OMP:
Segue abaixo uma possível solução para o problema:

Atenciosamente,
Clayton Menezes Silva

2 curtidas

Olá!

Eu fiz um vídeo informando as orientações corretas.

Deixo aqui o link: https://youtu.be/EVp7Gj-oP6w

2 curtidas

Olá, deixo para vocês a configuração que fiz tanto na versão 3.3.0-14 quanto na 3.4.0-1 de envio de emails, espero que ajude vocês a resolver o problema. Funciona para mim em ambas as versões

;;;;;;;;;;;;;;;;;;
; Email Settings ;
;;;;;;;;;;;;;;;;;;

[email]
---- INFORMACIÓN EN LA VERSIO 3.4.0-1 / INFORMAÇÕES NA VERSÃO 3.4.0-1 ----
; Default method to send emails
; Available options; sendmail, smtp, log, phpmailer
; default = sendmail
default = smtp

; Path to the sendmail, -bs argument is for using SMTP protocol
; sendmail_path = “/user/sbin/sendmail -bs”
sendmail_path = “/user/sbin/smtp -bs”

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

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

; Enable SMTP authentication
; Supported smtp_auth: ssl, tls (see PHPMailer SMTPSecure)
smtp_auth = starttls
smtp_username = username@dominio.xxx
smtp_password = password

---- INFORMACION EN LA VERSIO 3.3.0-14 /INFORMAÇÕES NA VERSÃO 3.3.4.0-14 ----
; Supported smtp_authtype: RAM-MD5, LOGIN, PLAIN, XOAUTH2 (see PHPMailer AuthType)
; (Leave blank to try them in that order)
;Codigo para las versiones 3.3.0-14 y 3.4.0-1 / Código para versões 3.3.0-14 e 3.4.0-1
smtp_authtype = Login

; The following are required for smtp_authtype = XOAUTH2 (e.g. GMail OAuth)
; (See Using Gmail with XOAUTH2 · PHPMailer/PHPMailer Wiki · GitHub)
; smtp_oauth_provider = Google
; smtp_oauth_email =
; smtp_oauth_clientid =
; smtp_oauth_clientsecret =
; smtp_oauth_refreshtoken =

; Enable suppressing verification of SMTP certificate in PHPMailer
; Note: this is not recommended per PHPMailer documentation
; smtp_suppress_cert_check = On

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

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

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

enable_attachments = On

; Force a DMARC compliant from header (RFC5322.From)
; If any of your users have email addresses in domains not under your control
; you may need to set this to be compliant with DMARC policies published by
; those 3rd party domains.
; Setting this will move the users address into the reply-to field and the
; from field wil be rewritten with the default_envelope_sender.
; To use this you must set force_default_enveloper_sender = On and
; default_envelope_sender must be set to a valid address in a domain you own.
force_dmarc_compliant_from = On

; The display name to use with a DMARC compliant from header
; By default the DMARC compliant from will have an empty name but this can
; be changed by adding a text here.
; You can use ‘%n’ to insert the users name from the original from header
; and ‘%s’ to insert the localized sitename.
; dmarc_compliant_from_displayname = ‘%n via %s’

; 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-privileged 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

1 curtida