Informa quantidade de arquivos anexados a mensagem.
Sintaxe
numérico GetAttachCount()
Retorno
Nome | Tipo | Descrição |
---|
nRet | numérico | Retorna o número de anexos da mensagem. |
Exemplos
user function getAttInfo()
Local oServer
Local oMessage
Local nAttach := 0
Local nMessages := 0
Local xRet
oServer := tMailManager():New()
writePProString( "Mail", "Protocol", "POP3", getsrvininame() )
oServer:SetUseSSL( .T. )
xRet := oServer:Init( "mail.totvs.com.br", "", "username", "password", 995, 0 )
if xRet <> 0
conout( "Could not initialize mail server: " + oServer:GetErrorString( xRet ) )
return
endif
xRet := oServer:POPConnect()
if xRet <> 0
conout( "Could not connect on POP3 server: " + oServer:GetErrorString( xRet ) )
return
endif
oServer:GetNumMsgs( @nMessages )
conout( "Number of messages: " + cValToChar( nMessages ) )
oMessage := tMailMessage():New()
oMessage:Clear()
conout( "Receiving newest message" )
xRet := oMessage:Receive( oServer, nMessages )
if xRet <> 0
conout( "Could not get message " + cValToChar( nMessages ) + ": " + oServer:GetErrorString( xRet ) )
return
endif
nAttach := oMessage:GetAttachCount()
conout( "Number of attachments: " + cValToChar( nAttach ) )
xRet := oServer:POPDisconnect()
if xRet <> 0
conout( "Could not disconnect from POP3 server: " + oServer:GetErrorString( xRet ) )
endif
return