Mail TLS 1.2 LegalMail PEC

Post Reply
Romeo
Posts: 328
Joined: Thu Jan 25, 2007 3:53 pm
Location: Milan (Italy)

Mail TLS 1.2 LegalMail PEC

Post by Romeo »

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
*
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Mail TLS 1.2 LegalMail PEC

Post by Enrico Maria Giordano »

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

Code: Select all

:Item( cSchema + "sendtls" ):Value := .T.
EMG
Romeo
Posts: 328
Joined: Thu Jan 25, 2007 3:53 pm
Location: Milan (Italy)

Re: Mail TLS 1.2 LegalMail PEC

Post by Romeo »

Ops,

forse ho cannato qualcosa...

Dopo in ufficio proverò dal cliente

E ti farò sapere

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

Re: Mail TLS 1.2 LegalMail PEC

Post by Romeo »

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
Post Reply