MailBoxSaveFileAs

sql

FUNCTION MailBoxSaveFileAs(IN mailbox HANDLE, IN id INT, IN fileidx INT, INOUT filename CHAR(255), IN destpath CHAR(255)) RETURNS INT;

Parameters

mailbox mailbox handle
id letter identifier
fileidx ordinal number of a file from the attachment (starting with 0); reasonable to use only if no filename is specified
filename name of a file from the attachment; if the fileidx parameter is set, filename will equal NIL (NULL) or empty string.
destpath the path (including the file name), where the file should be stored

Since version

6.0f

Description

Stores an attached file of the specified mail letter to a disk.

Loading attached files may be done in two ways. You may get information about attachments and attachments list using the MailBoxLoad and MailBoxGetFilInfo functions and then store selected files. If you need to get all files regardless of their names, you may call the MailBoxSaveFileAs function in a loop with the fileidx parameter ranging from 0 to (attachment count)–1. If the count of attachments is not known in advance, you may call this function until it returns the MAIL_NO_MORE_FILES error.

The folder specified in the destpath parameter must exist.

Example

Receiving example

Function value

This function returns 0 if successful, the error number otherwise.

See