FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Mail TLS 1.2 LegalMail PEC
Posts: 340
Joined: Thu Jan 25, 2007 03:53 PM
Mail TLS 1.2 LegalMail PEC
Posted: Wed Jul 03, 2019 06: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
*
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Mail TLS 1.2 LegalMail PEC
Posted: Wed Jul 03, 2019 07:39 AM
As I already advice you in the Italian forum, try with this:

Code (fw): Select all Collapse
:Item( cSchema + "sendtls" ):Value := .T.


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

Ops,

forse ho cannato qualcosa...

Dopo in ufficio proverò dal cliente

E ti farò sapere

ciao

Posts: 340
Joined: Thu Jan 25, 2007 03:53 PM
Re: Mail TLS 1.2 LegalMail PEC
Posted: Wed Jul 03, 2019 04: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
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Mail TLS 1.2 LegalMail PEC
Posted: Wed Jul 03, 2019 05:41 PM

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

EMG

Continue the discussion