Apresenta informações de um anexo de uma mensagem.
Sintaxe
GetAttachInfo( < nMsg > )
Parâmetros
Nome | Tipo | Descrição | Obrigatório | Referência |
|---|---|---|---|---|
nMsg | numérico | Indica o número da mensagem que deseja verificar. | X |
Retorno
Nome | Tipo | Descrição |
|---|---|---|
aRet | vetor | Retorna Nil (nulo) caso não encontre o anexo. Caso encontre, retorna um vetor com informações do anexo. |
Observações
Estrutura de retorno:
Nome | Descrição |
|---|---|
ShortName | O nome do attachment. |
Type | O tipo do anexo, por exemplo, text/plain ou image/x-png. |
Disposition | Tipo do arquivo. |
DispositionName | Nome do tipo de arquivo. |
ID | Identificação do anexo. |
Location | Local físico do anexo. |
| *Size | Tamanho do anexo. |
* Parâmetro Size só estará disponível em versão superior a 7.00.131227A.
Exemplos
Exemplo 1
user function getAttInfo()
Local oServer
Local oMessage
Local nAttach := 0, nI := 0
Local nMessages := 0
Local aAttInfo := {}
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()
for nI := 1 to nAttach
aAttInfo := oMessage:GetAttachInfo( nI )
varinfo( "attachment " + cValToChar( nI ), aAttInfo )
next nI
xRet := oServer:POPDisconnect()
if xRet <> 0
conout( "Could not disconnect from POP3 server: " + oServer:GetErrorString( xRet ) )
endif
return
Import HTML Content
Visão Geral
Conteúdo das Ferramentas