Problema Com Driver E-mail

Utilizo o driver E-mail para mandar alarmes das minhas aplicações.
Os alertas são enviados para uma lista de e-mail.
Tenho um problema que toda vez que o servidor do Elipse ou o serviço do Elipse é restartado, o driver gera um erro e não manda o e-mail.
Para solucionar o problema, sou obrigado a encaminhar para um único destinatário e depois disso posso alterar o destinatário para a lista.

Consegui capturar o seguinte log:

16/04/2018 18:03:02.286 (2248) TAG Tag(0.0.0.0).Validate = SUCCESS (type=10;flags=8)
16/04/2018 18:03:02.286 (2248) TAG ==> (0.000) Tag(0.0.0.0).WriteValue (20; 08:32:20.779) ‘walace.ferreira@ascenty.com, ferreira.walace@gmail.com’ = SUCCESS
16/04/2018 18:03:02.286 (2248) TAG <== (0.000) Tag(0.0.0.0).ReadValue = (18:03:02.286) ‘walace.ferreira@ascenty.com,ferreira.walace@gmail.com’
16/04/2018 18:03:02.286 (2248) TAG Tag(0.1.0.0).Validate = SUCCESS (type=10;flags=8)
16/04/2018 18:03:02.286 (2248) TAG ==> (0.000) Tag(0.1.0.0).WriteValue (20; 08:32:20.779) ’ = SUCCESS
16/04/2018 18:03:02.286 (2248) TAG <== (0.000) Tag(0.1.0.0).ReadValue = (18:03:02.286)
16/04/2018 18:03:02.302 (2248) TAG ==> (0.000) Tag(0.0.0.0).WriteValue (1970.01.01 00:00:00) null = SUCCESS
16/04/2018 18:03:02.302 (2248) TAG <== (0.000) Tag(0.0.0.0).ReadValue = (18:03:02.302) ‘’
16/04/2018 18:03:02.318 (2248) TAG ==> (0.000) Tag(0.1.0.0).WriteValue (1970.01.01 00:00:00) null = SUCCESS
16/04/2018 18:03:02.318 (2248) TAG <== (0.000) Tag(0.1.0.0).ReadValue = (18:03:02.318) ‘’
16/04/2018 18:03:02.568 (2248) TAG ==> (0.000) Tag(5.0.0.0).WriteValue (18:03:02.568) ‘bms.htl@ascenty.com’ = SUCCESS
16/04/2018 18:03:02.568 (2248) TAG ==> (0.000) Tag(6.0.0.0).WriteValue (18:03:02.568) ‘acesso@123’ = SUCCESS
16/04/2018 18:03:02.568 (2248) TAG ==> (0.000) Tag(1.0.0.0).WriteValue (18:03:02.568) ‘ALARME BMS - HORTOLÂNDIA | CATEGORIA: ELÉTRICA’ = SUCCESS
16/04/2018 18:03:02.568 (2248) TAG <== (0.000) Tag(1.0.0.0).ReadValue = (18:03:02.568) ‘ALARME BMS - HORTOLÂNDIA | CATEGORIA: ELÉTRICA’
16/04/2018 18:03:02.568 (2248) TAG ==> (0.000) Tag(2.0.0.0).WriteValue (18:03:02.568) ‘MENSAGEM: DRUPS 1-A EM EMERGENCY MODE | MESSAGE: DRUPS 1-A ON EMERGENCY MODE’ = SUCCESS
16/04/2018 18:03:02.568 (2248) TAG <== (0.000) Tag(2.0.0.0).ReadValue = (18:03:02.568) ‘MENSAGEM: DRUPS 1-A EM EMERGENCY MODE | MESSAGE: DRUPS 1-A ON EMERGENCY MODE’
16/04/2018 18:03:02.568 (2248) DRIVER Socket created with success!
16/04/2018 18:03:02.568 (2248) DRIVER Connecting in host smtp.office365.com port 587
16/04/2018 18:03:02.599 (2248) DRIVER Socket connected with success!
16/04/2018 18:03:02.599 (2248) DRIVER Elipse connected to Mail Server
16/04/2018 18:03:02.599 (2248) IO RX: 220 CP2P215CA0003.outlook.office365.com Microsoft ESMTP MAIL Service ready at Mon, 16 Apr 2018 21:03:03 +0000[0D][0A]
16/04/2018 18:03:02.599 (2248) IO TX: EHLO BMS-HTL-01.ascenty.local[0D][0A]
16/04/2018 18:03:02.615 (2248) IO RX: 250-CP2P215CA0003.outlook.office365.com Hello [177.185.4.151][0D][0A]250-SIZE 157286400[0D][0A]250-PIPELINING[0D][0A]250-DSN[0D][0A]250-ENHANCEDSTATUSCODES[0D][0A]250-STARTTLS[0D][0A]250-8BITMIME[0D][0A]250-BINARYMIME[0D][0A]250-CHUNKING[0D][0A]250 SMTPUTF8[0D][0A]
16/04/2018 18:03:02.615 (2248) DRIVER OK: Authentication Method: STARTTLS
16/04/2018 18:03:02.615 (2248) IO TX: STARTTLS[0D][0A]
16/04/2018 18:03:02.615 (2248) IO RX: 220 2.0.0 SMTP server ready[0D][0A]
16/04/2018 18:03:02.646 (2248) DRIVER OK: Security SSL/TLS connection is enabled!!
16/04/2018 18:03:02.646 (2248) IO TX: EHLO BMS-HTL-01.ascenty.local[0D][0A]
16/04/2018 18:03:02.646 (2248) IO RX: 250-CP2P215CA0003.outlook.office365.com Hello [177.185.4.151][0D][0A]250-SIZE 157286400[0D][0A]250-PIPELINING[0D][0A]250-DSN[0D][0A]250-ENHANCEDSTATUSCODES[0D][0A]250-AUTH LOGIN XOAUTH2[0D][0A]250-8BITMIME[0D][0A]250-BINARYMIME[0D][0A]250-CHUNKING[0D][0A]250 SMTPUTF8[0D][0A]
16/04/2018 18:03:02.646 (2248) DRIVER OK: Authentication Method: AUTH LOGIN
16/04/2018 18:03:02.646 (2248) IO TX: AUTH LOGIN[0D][0A]
16/04/2018 18:03:02.646 (2248) IO RX: 334 VXNlcm5hbWU6[0D][0A]
16/04/2018 18:03:02.646 (2248) IO TX: Ym1zLmh0bEBhc2NlbnR5LmNvbQ==[0D][0A]
16/04/2018 18:03:02.661 (2248) IO RX: 334 UGFzc3dvcmQ6[0D][0A]
16/04/2018 18:03:02.661 (2248) IO TX: YWNlc3NvQDEyMw==[0D][0A]
16/04/2018 18:03:06.865 (2248) IO RX: 235 2.7.0 Authentication successful target host FR1PR80MB0742.lamprd80.prod.outlook.com[0D][0A]
16/04/2018 18:03:06.865 (2248) DRIVER OK: Authentication successful
16/04/2018 18:03:06.865 (2248) IO TX: MAIL FROM:bms.htl@ascenty.com[0D][0A]
16/04/2018 18:03:07.068 (2248) IO RX: 250 2.1.0 Sender OK[0D][0A]
16/04/2018 18:03:07.068 (2248) IO TX: DATA[0D][0A]
16/04/2018 18:03:12.131 (2248) IO RX: 503 5.5.2 Need rcpt command [FR1PR80MB0742.lamprd80.prod.outlook.com][0D][0A]
16/04/2018 18:03:12.131 (2248) DRIVER Receive() error: Received a Negative Completion reply - SMTP code = 503
16/04/2018 18:03:12.131 (2248) DRIVER Last sent message was DATA
16/04/2018 18:03:12.131 (2248) IO TX: QUIT[0D][0A]
16/04/2018 18:03:12.193 (2248) IO RX: 221 2.0.0 Service closing transmission channel[0D][0A]
16/04/2018 18:03:12.193 (2248) DRIVER Elipse disconnected from Mail Server
16/04/2018 18:03:12.193 (2248) DRIVER SSLDisconnect() error: SSL_shutdown() failed:
16/04/2018 18:03:12.193 (2248) DRIVER OK: Security SSL/TLS connection is disabled!!
16/04/2018 18:03:12.193 (2248) DRIVER Socket closed with success!
16/04/2018 18:03:12.193 (2248) DRIVER Email couldn’t be sent
16/04/2018 18:03:12.193 (2248) TAG ==> (9.615) Tag(3.0.0.0).WriteValue (18:03:02.568) 1 = ERROR (hr=80004005)
16/04/2018 18:03:12.193 (2248) TAG ==> (0.000) Tag(5.0.0.0).WriteValue (18:03:12.193) ‘bms.htl@ascenty.com’ = SUCCESS
16/04/2018 18:03:12.193 (2248) TAG ==> (0.000) Tag(6.0.0.0).WriteValue (18:03:12.193) ‘acesso@123’ = SUCCESS
16/04/2018 18:03:12.193 (2248) TAG ==> (0.000) Tag(1.0.0.0).WriteValue (18:03:12.193) ‘ALARME BMS - HORTOLÂNDIA | CATEGORIA: ELÉTRICA’ = SUCCESS
16/04/2018 18:03:12.193 (2248) TAG <== (0.000) Tag(1.0.0.0).ReadValue = (18:03:12.193) ‘ALARME BMS - HORTOLÂNDIA | CATEGORIA: ELÉTRICA’
16/04/2018 18:03:12.193 (2248) TAG ==> (0.000) Tag(2.0.0.0).WriteValue (18:03:12.193) ‘MENSAGEM: DRUPS 1-A EM EMERGENCY MODE | MESSAGE: DRUPS 1-A ON EMERGENCY MODE’ = SUCCESS
16/04/2018 18:03:12.193 (2248) TAG <== (0.000) Tag(2.0.0.0).ReadValue = (18:03:12.193) ‘MENSAGEM: DRUPS 1-A EM EMERGENCY MODE | MESSAGE: DRUPS 1-A ON EMERGENCY MODE’
16/04/2018 18:03:12.193 (2248) DRIVER Socket created with success!
16/04/2018 18:03:12.193 (2248) DRIVER Connecting in host smtp.office365.com port 587
16/04/2018 18:03:12.193 (2248) DRIVER Socket connected with success!
16/04/2018 18:03:12.193 (2248) DRIVER Elipse connected to Mail Server
16/04/2018 18:03:12.209 (2248) IO RX: 220 CP2P215CA0001.outlook.office365.com Microsoft ESMTP MAIL Service ready at Mon, 16 Apr 2018 21:03:12 +0000[0D][0A]
16/04/2018 18:03:12.209 (2248) IO TX: EHLO BMS-HTL-01.ascenty.local[0D][0A]
16/04/2018 18:03:12.224 (2248) IO RX: 250-CP2P215CA0001.outlook.office365.com Hello [177.185.4.151][0D][0A]250-SIZE 157286400[0D][0A]250-PIPELINING[0D][0A]250-DSN[0D][0A]250-ENHANCEDSTATUSCODES[0D][0A]250-STARTTLS[0D][0A]250-8BITMIME[0D][0A]250-BINARYMIME[0D][0A]250-CHUNKING[0D][0A]250 SMTPUTF8[0D][0A]
16/04/2018 18:03:12.224 (2248) DRIVER OK: Authentication Method: STARTTLS
16/04/2018 18:03:12.224 (2248) IO TX: STARTTLS[0D][0A]
16/04/2018 18:03:12.224 (2248) IO RX: 220 2.0.0 SMTP server ready[0D][0A]
16/04/2018 18:03:12.271 (2248) DRIVER OK: Security SSL/TLS connection is enabled!!
16/04/2018 18:03:12.271 (2248) IO TX: EHLO BMS-HTL-01.ascenty.local[0D][0A]
16/04/2018 18:03:12.287 (2248) IO RX: 250-CP2P215CA0001.outlook.office365.com Hello [177.185.4.151][0D][0A]250-SIZE 157286400[0D][0A]250-PIPELINING[0D][0A]250-DSN[0D][0A]250-ENHANCEDSTATUSCODES[0D][0A]250-AUTH LOGIN XOAUTH2[0D][0A]250-8BITMIME[0D][0A]250-BINARYMIME[0D][0A]250-CHUNKING[0D][0A]250 SMTPUTF8[0D][0A]
16/04/2018 18:03:12.287 (2248) DRIVER OK: Authentication Method: AUTH LOGIN
16/04/2018 18:03:12.287 (2248) IO TX: AUTH LOGIN[0D][0A]
16/04/2018 18:03:12.287 (2248) IO RX: 334 VXNlcm5hbWU6[0D][0A]
16/04/2018 18:03:12.287 (2248) IO TX: Ym1zLmh0bEBhc2NlbnR5LmNvbQ==[0D][0A]
16/04/2018 18:03:12.303 (2248) IO RX: 334 UGFzc3dvcmQ6[0D][0A]
16/04/2018 18:03:12.303 (2248) IO TX: YWNlc3NvQDEyMw==[0D][0A]
16/04/2018 18:03:16.912 (2248) IO RX: 235 2.7.0 Authentication successful target host CP2PR80MB0738.lamprd80.prod.outlook.com[0D][0A]
16/04/2018 18:03:16.912 (2248) DRIVER OK: Authentication successful
16/04/2018 18:03:16.912 (2248) IO TX: MAIL FROM:bms.htl@ascenty.com[0D][0A]
16/04/2018 18:03:16.943 (2248) IO RX: 250 2.1.0 Sender OK[0D][0A]
16/04/2018 18:03:16.943 (2248) IO TX: DATA[0D][0A]
16/04/2018 18:03:21.959 (2248) IO RX: 503 5.5.2 Need rcpt command [CP2PR80MB0738.lamprd80.prod.outlook.com][0D][0A]
16/04/2018 18:03:21.959 (2248) DRIVER Receive() error: Received a Negative Completion reply - SMTP code = 503
16/04/2018 18:03:21.959 (2248) DRIVER Last sent message was DATA
16/04/2018 18:03:21.959 (2248) IO TX: QUIT[0D][0A]
16/04/2018 18:03:21.959 (2248) IO RX: 221 2.0.0 Service closing transmission channel[0D][0A]
16/04/2018 18:03:21.959 (2248) DRIVER Elipse disconnected from Mail Server
16/04/2018 18:03:21.959 (2248) DRIVER SSLDisconnect() error: SSL_shutdown() failed:
16/04/2018 18:03:21.959 (2248) DRIVER OK: Security SSL/TLS connection is disabled!!
16/04/2018 18:03:21.959 (2248) DRIVER Socket closed with success!
16/04/2018 18:03:21.959 (2248) DRIVER Email couldn’t be sent

@Walace, bom dia.

Conforme observou, parece que há um erro no endereçamento do receptor (destinatário).

No início do log tem estas linhas, onde:

  1. Aqui ocorreu tudo bem:
  1. Logo depois foi lido novamente e retornou vazio:
  1. Aqui retorna o erro 503 [(Bad sequence of commands)]
    (https://www.greenend.org.uk/rjk/tech/smtpreplies.html#RCPT):

Por favor, para análise inicial, poderia dar mais detalhes de como está inserindo o valor na tag destinatário ou compartilhar o script que utilizou para enviar o e-mail?

Sds.

EDIT 1: Se estiver utilizando a versão nova do driver (v2.0.10) no E3, pode-se configurar uma tag com o N1 = 90 e associar a um display na tela.
Sempre que alguma escrita for feita em qualquer tag do driver Sendmail, a tag retornará um código. Este código poderá indicar um erro ou sucesso na escrita da tag (verificar manual do driver em “Códigos de Erros para Tags de Escrita”).

Boa tarde,
Segue o código abaixo.

O erro que dá é o 503, bad sequence of events.

Segue o código:
Sub Alarme_alarme()

Application.GetObject(“EMAIL.USUARIO”).Value = "bms.htl@ascenty.com"
Application.GetObject(“EMAIL.SENHA”).Value = “XXXXXX”
Application.GetObject(“EMAIL.ASSUNTO”).Value = “ALARME BMS - HORTOLÂNDIA | CATEGORIA: HVAC”
Application.GetObject(“EMAIL.CORPO”).Value = “MENSAGEM: ALARME NO CHILLER - 01”

Application.GetObject(“EMAIL.PRIORIDADE”).Value = 1

End Sub

@Walace, bom dia.

Neste script falta o destinatário. Como está inserindo o destinatário (fixo, setpoint, etc)?

Sds.

Fernado,

Escrevo em um tag interno e no tag do driver faço uma conexão simples para este tag interno.

@Walace, bom dia.

Obrigado pelo retorno.

No caso de reiniciar o servidor de aplicação, isto ocorre pois o tag interno perde o valor caso não tenha um Save() configurado nos scripts dele.

Entretanto, nos logs acima, caso o servidor não tenha “caído”, parece que o valor foi “retirado”.

Realizei alguns testes (tanto escrevendo no tag interno ou direto no tag de comunicação quanto por scripts) e não consegui reproduzir o problema de enviar os emails em lista após reiniciar o servidor.

Uma sugestão de teste seria escrevendo o e-mail do destinatário script do alarme:

Sub Alarme_alarme()

Application.GetObject(“EMAIL.PARA”).WriteEx "walace.ferreira@ascenty.com, ferreira.walace@gmail.com"

Application.GetObject(“EMAIL.USUARIO”).WriteEx "bms.htl@ascenty.com"
Application.GetObject(“EMAIL.SENHA”).WriteEx “XXXXXX”
Application.GetObject(“EMAIL.ASSUNTO”).WriteEx “ALARME BMS - HORTOLÂNDIA | CATEGORIA: HVAC”
Application.GetObject(“EMAIL.CORPO”).WriteEx “MENSAGEM: ALARME NO CHILLER - 01”

Application.GetObject(“EMAIL.PRIORIDADE”).WriteEx 1

End Sub

Obs.: Se possível, compartilhar os logs do driver novamente após o teste e, caso não funcione, a aplicação.

Sds.