#INCLUDE "TOTVS.CH"
#DEFINE EMAIL_ACCOUNT 'p10teste'
#DEFINE EMAIL_PASSWORD '123'
#DEFINE EMAIL_SERVER 'mail.totvs.com.br'
User Function mail004()
Local oMail := TMailMng():New( 1, .T. )
Local nRet := 0
Local nNumMsg := 0
oMail:cUser := EMAIL_ACCOUNT
oMail:cPass := EMAIL_PASSWORD
oMail:cSrvAddr := EMAIL_SERVER
nRet := oMail:Connect()
if nRet <> 0
conout( nret )
conout( oMail:GetErrorString( nret ) )
return
endif
nRet := oMail:GetNumMsgs( @nNumMsg )
if nRet == 0
conout( "Count Successful" )
conout( nNumMsg )
else
conout( nRet )
conout( oMail:GetErrorString( nRet ) )
endif
if nNumMsg > 0
nRet := oMail:SetMsgFlags( 1, "S" )
if nRet <> 0
conout( nRet )
conout( oMail:GetErrorString( nRet ) )
endif
endif
oMail:Disconnect()
return
|