4D Internet Commands v14

IMAP_Download

Home

 
4D Internet Commands v14
IMAP_Download

IMAP_Download 


 

IMAP_Download ( imap_ID ; msgNum ; headerOnly ; fileName ; updateSeen ) -> Function result 
Parameter Type   Description
imap_ID  Longint in Reference to an IMAP login
msgNum  Longint in Message number
headerOnly  Integer in 0 = Entire message, 1 = Only header
fileName  Text in Local Filename
in Resulting Local Filename
updateSeen  Integer in 0 = Add \Seen Flag; 1= Do not add \Seen Flag
Function result  Integer in Error code

The IMAP_Download command is designed to retrieve a message from an IMAP server by downloading it to a disk-based file. Any IMAP message which contains attachments or whose size is greater than 32K should be downloaded with this command. File attachments can only be extracted from the messages retrieved in this way.

imap_ID is a long integer reference to an open connection created with IMAP_Login.

msgNum is a long integer value indicating which message in the mailbox to retrieve. msgNum represents the position of a message within the current list of messages. You cannot rely on the msgNum remaining the same for a specific e-mail item from session to session.

headerOnly is an integer value which denotes whether to retrieve the entire contents of the message or just the header information.

fileName contains the name of the file and the optional path where you would like the message saved. This value may be specified in three different ways:

  • "" = Saves the file in the folder set by IMAP_SetPrefs, with the name “temp1” (if a file with the same name already exists, the filenames “temp2”, “temp3”, etc. will be tried until an unused file name is found).
  • "FileName" = Saves the file in the folder set by IMAP_SetPrefs entitled FileName.
  • "Path:FileName" = Saves the file in the path specified with the name FileName.

In the first two cases, if no folder has been specified by IMAP_SetPrefs, the message will be saved in the same folder as the structure of the database (with 4D single-user) or in the 4D Client folder (with 4D Server).

After the file has been saved to the disk, the final name of the file will be returned to the variable passed as the fileName parameter. If you attempt to call IMAP_Download with a fileName that already exists within the download folder, the name will be numerically incremented and its new value as saved to the disk will be returned to the fileName variable.

updateSeen is an integer value that indicates if the \Seen flag must be added to the message flags list, whether implicitly or not. This parameter is optional and a default value is used if this parameter is not passed:

  • 0 = Add \Seen Flag
  • 1 = Do not add \Seen Flag

Default value is set to 0 which implicitly means add \Seen flag.

 
PROPERTIES 

Product: 4D Internet Commands
Theme: IC IMAP Review Mail
Number: 88867

 
HISTORY 

Created: 4D Internet Commands 6.8.1

 
SEE ALSO 

IMAP_GetMessage
IMAP_SetPrefs

 
ARTICLE USAGE

4D Internet Commands ( 4D Internet Commands v11.4)
4D Internet Commands ( 4D v13.2)
4D Internet Commands ( 4D Internet Commands v12.1)
4D Internet Commands ( 4D Internet Commands v14 R2)
4D Internet Commands ( 4D Internet Commands v14)
4D Internet Commands ( 4D Internet Commands v14 R3)
4D Internet Commands ( 4D Internet Commands v14 R4)