Ciao all
I HAVE NO PROBLEM IF I USE THE BELOW SAMPLE USING PEC MAIL
BUT I GOT ERROR IF I WISH TO USE IT USING NO PEC MAIL, LIKE GMAIL (EXAMPLE)
PLEASE CAN U TELL ME WHAT IS WRONG ?
OR CAN U SEND ME A SMAL EXAMPLE TO SEND MAIL USING NO PEC (OR ALSO PEC)
GRAZIE !!!!
************************** SHORT EXAMPLE ************
function mail_dct(_from,_to,_password,_subject,_textbody,_arrattach,_smtpserver)
LOCAL oEmailMsg
LOCAL cSchema := "http://schemas.microsoft.com/cdo/configuration/"
LOCAL _lok:=.t.,_j,_cfile
b_oxon(10,"Inviando mail...")
oEmailMsg := CREATEOBJECT ( "CDO.Message" )
WITH OBJECT oEmailMsg
:From := alltrim(_from)
:To := alltrim(_to)
:CC := ""
:BCC := ""
:Subject := _subject
:TextBody := _textbody
:AddAttachment( ALLTRIM( "c:\test0.prg" ) )
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.
* only for pec mail :Item( cSchema + "sendtls" ):Value := .T.
:Item( cSchema + "sendtls" ):Value := .F.
:Item( cSchema + "sendusername" ):Value := alltrim(_from)
:Item( cSchema + "sendpassword" ):Value := alltrim(_password)
:Item( cSchema + "smtpconnectiontimeout"):Value := 30
:Update()
END WITH
:Send()
END WITH
RETURN nil