Enrico Maria Giordano wrote:Can I see a reduced and self-contained sample of the problem?
EMG
Enrico above you can see how i send mails, but in destination body email the caracters display wrong. Thanks!
Static Function Config_Mail()
local lRet := .f.
local oCfg, oError
local cServ := "smtp.gmail.com"
local nPort := "465"
local lAut := .t.
local lSSL := .t.
local cUser := "blablabla"
local cRemt := "blablabla@gmail.com"
local cDest := "blablabla@gmail.com"
local cPass := "blablabla"
local cSubject := "test"
local cCC := ""
local cCCO := ""
local cAttach := {}
local cTxt := "Segue convocação para assembleia geral extraordinária tendo como pauta negociação da convenção coletiva."
TRY
oCfg := CREATEOBJECT( "CDO.Configuration" )
WITH OBJECT oCfg:Fields
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpserver" ):Value := cServ
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpserverport" ):Value := nPort
:Item( "http://schemas.microsoft.com/cdo/configuration/sendusing" ):Value := 2
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate" ):Value := lAut
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpusessl" ):Value := lSSL
:Item( "http://schemas.microsoft.com/cdo/configuration/sendusername" ):Value := cUser
:Item( "http://schemas.microsoft.com/cdo/configuration/sendpassword" ):Value := cPass
:Update()
END WITH
lRet := .t.
CATCH oError
MsgInfo( "Não Foi possível Enviar o e-Mail!" +CRLF+ ;
"Error: " + Transform(oError:GenCode, nil) + ";" +CRLF+ ;
"SubC: " + Transform(oError:SubCode, nil) + ";" +CRLF+ ;
"OSCode: " + Transform(oError:OsCode, nil) + ";" +CRLF+ ;
"SubSystem: " + Transform(oError:SubSystem, nil) + ";" +CRLF+ ;
"Mensaje: " + oError:Description, "Atenção" )
lRet := .f.
END
if lRet
lRet := Envia_Mail(oCfg,cRemt,cDest, cCC, cCCO, cTxt, cSubject, cAttach)
endif
Return lRet
********************************************************************************
Static Function Envia_Mail(oCfg,cFrom, cTo, cCC, cBCC, cMsg, cSubject, cAttach)
local cToken
local lRet := .f.
local Vezes := 0
Do While Vezes <= 5
cTo := Destinatarios( cTo ) //--> PARA
cCC := Destinatarios( cCC ) //--> COM COPIA
cBCC := Destinatarios( cBCC ) //--> COM COPIA OCULTA
TRY
oMsg := CREATEOBJECT ( "CDO.Message" )
WITH OBJECT oMsg
:Configuration = oCfg
:From = cFrom
:To = cTo
:CC = cCC
:BCC = cBCC
:Subject = cSubject
:TextBody = cMsg
For x2 := 1 To Len( cAttach )
if cAttach[x2] <> NIL
:AddAttachment(cAttach[x2])
endif
Next
:Send()
END WITH
lRet := .t.
CATCH
lRet := .f.
++Vezes
loop
END
Exit
Enddo
Return lRet