FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index All products support Mail TLS 1.2 LegalMail Fatt Elettronica
Posts: 340
Joined: Thu Jan 25, 2007 03:53 PM
Mail TLS 1.2 LegalMail Fatt Elettronica
Posted: Tue Jul 02, 2019 04:39 PM

Ciao
dal 1/Luglio Legalmail usa il protocollo TLS 1.2 per la sua PEC.

Io prima del 1/Luglio, per inviare la Fatt.Elettronica, usavo l'esempio in calce e funzionava bene, ora non va con legalmail

C'e' qualche modifica che devo fare o altro esempio che posso usare ?

Grazie

Romeo

ESEMPIO FUNZIONANANTE FINO al 30/6/19 *

function mail_dct()
parameter _from,_to,_password,_subject,_textbody,_arrattach,_smtpserver

LOCAL oEmailMsg
LOCAL cSchema := "http://schemas.microsoft.com/cdo/configuration/"
LOCAL _j,_cfile

oEmailMsg := CREATEOBJECT ( "CDO.Message" )
WITH OBJECT oEmailMsg
:From := alltrim(_from)
:To := alltrim(_to)

     :CC       := ""
     :BCC      := ""

     :Subject  := _subject
     :TextBody := _textbody

 for _j:=1 to len(_arrattach)
  _cfile:=_arrattach[_j]
  :AddAttachment(_cfile)   
 next _j

     WITH OBJECT :configuration:Fields
        :Item( cSchema + "smtpserver" ):Value       := alltrim(_smtpserver)

        :Item( cSchema + "smtpserverport" ):Value   := 465

        :Item( cSchema + "sendusing" ):Value        := 2

        :Item( cSchema + "smtpauthenticate" ):Value := .T.

        :Item( cSchema + "smtpusessl" ):Value       := .T.

        :Item( cSchema + "sendusername" ):Value     := alltrim(_from)

        :Item( cSchema + "sendpassword" ):Value     := alltrim(_password)

        :Item( cSchema + "smtpconnectiontimeout"):Value := 30

        :Update()

     END WITH

END WITH
*FINE

Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Mail TLS 1.2 LegalMail Fatt Elettronica
Posted: Tue Jul 02, 2019 05:13 PM

Prova con

"http://schemas.microsoft.com/cdo/configuration/sendtls"

EMG

Posts: 340
Joined: Thu Jan 25, 2007 03:53 PM
Re: Mail TLS 1.2 LegalMail Fatt Elettronica
Posted: Tue Jul 02, 2019 05:33 PM

Ops !

Non ha funzionato !

La TLS 1.2 è disponibile dal 1 luglio e prima o poi anche gli altri gestori si adegueranno.

Bisogna che qualche "scienziato" ci dia qualche dritta !

Mannagggggia !

Grazie cmq
R

Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Mail TLS 1.2 LegalMail Fatt Elettronica
Posted: Tue Jul 02, 2019 05:37 PM

"Non ha funzionato" in che senso? Dovrebbe funzionare. Puoi mandarmi via email tutto il necessario per fare un test?

EMG

Posts: 340
Joined: Thu Jan 25, 2007 03:53 PM
Re: Mail TLS 1.2 LegalMail Fatt Elettronica
Posted: Tue Jul 02, 2019 07:41 PM

Ciao Enrico

ti allego in calce un esempio minimale, senza però user e password di accesso a LegalMail, in quanto il cliente non le da neanche a me (almeno per il momento)

Magari puoi controllare se è tutto a posto a livello di parametri e/o sintassi.

Grazie 10000

** TEST **

*

include "FiveWin.ch"

*
*
function main
LOCAL oEmailMsg

LOCAL cSchema := "http://schemas.microsoft.com/cdo/configuration/sendtls/"

Local err:=.f.

memowrit(hb_curdrive()+":\"+curdir()+"\test.txt","File test allegato")

oEmailMsg := CREATEOBJECT ( "CDO.Message" )

WITH OBJECT oEmailMsg

:From := "xxx1960@legagmail.it"
:To := "xxx1960@legagmail.it"

:CC :=""
:BCC :=""
:Subject := "Soggetto"
:TextBody := "Testo del messaggio"

:AddAttachment(hb_curdrive()+":\"+curdir()+"\test.txt" )

WITH OBJECT :configuration:Fields
:Item( cSchema + "smtpserver" ):Value := "sendm.cert.legalmail.it"

:Item( cSchema + "smtpserverport" ):Value   := 465

:Item( cSchema + "sendusing" ):Value        := 2
:Item( cSchema + "smtpauthenticate" ):Value := .T.
:Item( cSchema + "smtpusessl" ):Value       := .T.

:Item( cSchema + "sendusername" ):Value     := "xxx1960@legagmail.it"
:Item( cSchema + "sendpassword" ):Value     := "Pippo"
:Item( cSchema + "smtpconnectiontimeout"):Value := 30

:Update()

END WITH
TRY
:Send()
CATCH
err:=.t.
END
END WITH

if err
msginfo("Errore di invio")
else
msginfo("Errore: ok !")
endif
return nil
*

Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Mail TLS 1.2 LegalMail Fatt Elettronica
Posted: Tue Jul 02, 2019 07:45 PM

Non ci hai aggiunto il parametro che ti avevo detto di provare. E comunque non posso fare nessun test senza i dati di accesso.

EMG

Posts: 340
Joined: Thu Jan 25, 2007 03:53 PM
Re: Mail TLS 1.2 LegalMail Fatt Elettronica
Posted: Tue Jul 02, 2019 08:03 PM

Lo strano è che io ho una PEC su Aruba e funziona il mio vecchio programma.

Eppure parrebbe che anche Aruba (come LegalMail) abbia il TLS 1.2

Riesci a verificare se è vero che Aruba ha il TLS 1.2 ?

R

Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Posts: 340
Joined: Thu Jan 25, 2007 03:53 PM
Re: Mail TLS 1.2 LegalMail Fatt Elettronica
Posted: Wed Jul 03, 2019 06:48 AM

Ciao Enrico,

il parametro che mi avevi detto era questo:

LOCAL cSchema := "http://schemas.microsoft.com/cdo/configuration/sendtls/"

E io l'ho aggiunto nel mio esempio

Poi per Aruba ho trovato questo link dove dice che usano il TLS 1.2:

https://guide.aruba.it/it/news/pec-30-apr-2019-1.aspx

Allora il mio esempio, a parte la user/pass ti pare corretto ?

C'è qualcuno che ha LEGALMAIL e puo per favore provarlo ?

Grazie

Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Mail TLS 1.2 LegalMail Fatt Elettronica
Posted: Wed Jul 03, 2019 07:44 AM
Romeo wrote:Ciao Enrico,

il parametro che mi avevi detto era questo:

LOCAL cSchema := "http://schemas.microsoft.com/cdo/configuration/sendtls/"

E io l'ho aggiunto nel mio esempio


Mi fai vedere esattamente come l'hai aggiunto?

EMG
Posts: 340
Joined: Thu Jan 25, 2007 03:53 PM
Re: Mail TLS 1.2 LegalMail Fatt Elettronica
Posted: Wed Jul 03, 2019 12:05 PM

Te l'ho inserito prima, ma te lo reiserisco:

** TEST **

*

include "FiveWin.ch"

*
*
function main
LOCAL oEmailMsg

LOCAL cSchema := "http://schemas.microsoft.com/cdo/configuration/sendtls/"

Local err:=.f.

memowrit(hb_curdrive()+":\"+curdir()+"\test.txt","File test allegato")

oEmailMsg := CREATEOBJECT ( "CDO.Message" )

WITH OBJECT oEmailMsg

:From := "xxx1960@legagmail.it"
:To := "xxx1960@legagmail.it"

:CC :=""
:BCC :=""
:Subject := "Soggetto"
:TextBody := "Testo del messaggio"

:AddAttachment(hb_curdrive()+":\"+curdir()+"\test.txt" )

WITH OBJECT :configuration:Fields
:Item( cSchema + "smtpserver" ):Value := "sendm.cert.legalmail.it"

:Item( cSchema + "smtpserverport" ):Value := 465

:Item( cSchema + "sendusing" ):Value := 2
:Item( cSchema + "smtpauthenticate" ):Value := .T.
:Item( cSchema + "smtpusessl" ):Value := .T.

:Item( cSchema + "sendusername" ):Value := "xxx1960@legagmail.it"
:Item( cSchema + "sendpassword" ):Value := "Pippo"
:Item( cSchema + "smtpconnectiontimeout"):Value := 30

:Update()

END WITH
TRY
:Send()
CATCH
err:=.t.
END
END WITH

if err
msginfo("Errore di invio")
else
msginfo("Errore: ok !")
endif
return nil

Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Mail TLS 1.2 LegalMail Fatt Elettronica
Posted: Wed Jul 03, 2019 12:22 PM

L'avevo già visto ma lì quello che ti avevo detto di aggiungere non c'è.

EMG

Posts: 340
Joined: Thu Jan 25, 2007 03:53 PM
Re: Mail TLS 1.2 LegalMail Fatt Elettronica
Posted: Wed Jul 03, 2019 05:13 PM

Eccolo !

Fatto le prove e con ARUBA che ha il TLS 1.2 funziona, magari è compatibile con le precedenti versioni

Con LEGALMAIL invece non va !

Quindi l'esempio in calce funziona con ARUBA PEC, mentre non va con LEGALMAIL PEC.

Suggerimenti ?

Grazie
Romeo
NB: userid e password sono fittizie, il cliente è restio a darmele !

** esempio**

include "FiveWin.ch"

*
*
function main
LOCAL oEmailMsg

LOCAL cSchema := "http://schemas.microsoft.com/cdo/configuration/"

Local err:=.f.

memowrit(hb_curdrive()+":\"+curdir()+"\test.txt","File test attached")

oEmailMsg := CREATEOBJECT ( "CDO.Message" )

WITH OBJECT oEmailMsg

:From := "xxx1960@legagmail.it"
:To := "xxx1960@legagmail.it"

:CC :=""
:BCC :=""
:Subject := "Soggetto"
:TextBody := "Testo del messaggio"

:AddAttachment(hb_curdrive()+":\"+curdir()+"\test.txt" )

WITH OBJECT :configuration:Fields
:Item( cSchema + "smtpserver" ):Value := "sendm.cert.legalmail.it"

:Item( cSchema + "smtpserverport" ):Value := 465

:Item( cSchema + "sendusing" ):Value := 2
:Item( cSchema + "smtpauthenticate" ):Value := .T.
:Item( cSchema + "smtpusessl" ):Value := .T.

:Item( cSchema + "sendtls" ):Value := .T. && EMG AGGIUNTA

:Item( cSchema + "sendusername" ):Value := "xxx1960@legagmail.it"
:Item( cSchema + "sendpassword" ):Value := "Pippo"
:Item( cSchema + "smtpconnectiontimeout"):Value := 30

:Update()

END WITH
TRY
:Send()
CATCH
err:=.t.
END
END WITH

if err
msginfo("Error ")
else
msginfo("Not Errore !")
endif
return nil

Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Mail TLS 1.2 LegalMail Fatt Elettronica
Posted: Wed Jul 03, 2019 05:43 PM

Prova con la porta 25. Poi prova a rimuovere "smtpusessl" sia con la porta 465 che con la porta 25.

EMG

Posts: 340
Joined: Thu Jan 25, 2007 03:53 PM
Re: Mail TLS 1.2 LegalMail Fatt Elettronica
Posted: Thu Jul 04, 2019 03:56 PM

Ciao Enrico,

fatto le prove.... ma non va !

Ti ho inviato in tua mail il programmino di test !

Grazie per il possibile aiuto

Romeo