Mail TLS 1.2 LegalMail PEC

Mail TLS 1.2 LegalMail PEC

Postby Romeo » Wed Jul 03, 2019 6:58 am

Hi to all,

please is there someone that can test the below little program, to check if it works ?

I have problems only with LEGALMAIL (PEC) that at moment seems use the new TLS 1.2 protocol


Many many many tks for any help

Of course you have to use your own userid/password and email for LEGALMAIL

Romeo

********************************

** TEST PRG **

*

#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 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 + "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
*
Romeo
 
Posts: 340
Joined: Thu Jan 25, 2007 3:53 pm
Location: Milan (Italy)

Re: Mail TLS 1.2 LegalMail PEC

Postby Enrico Maria Giordano » Wed Jul 03, 2019 7:39 am

As I already advice you in the Italian forum, try with this:

Code: Select all  Expand view  RUN
:Item( cSchema + "sendtls" ):Value := .T.


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Mail TLS 1.2 LegalMail PEC

Postby Romeo » Wed Jul 03, 2019 12:06 pm

Ops,

forse ho cannato qualcosa...

Dopo in ufficio proverò dal cliente

E ti farò sapere

ciao
Romeo
 
Posts: 340
Joined: Thu Jan 25, 2007 3:53 pm
Location: Milan (Italy)

Re: Mail TLS 1.2 LegalMail PEC

Postby Romeo » Wed Jul 03, 2019 4:21 pm

Ciao

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

** 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
Romeo
 
Posts: 340
Joined: Thu Jan 25, 2007 3:53 pm
Location: Milan (Italy)

Re: Mail TLS 1.2 LegalMail PEC

Postby Enrico Maria Giordano » Wed Jul 03, 2019 5:41 pm

Try with port 25 and/or removing "smtpusessl".

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 76 guests