cfimap

Queries an IMAP server to retrieve and manage mails within multiple folders.

  <cfimap>

 cfimap();

Attribute Reference

password string

Specifies the password for assessing the users e-mail account.

secure boolean

Specifies whether the IMAP server uses a Secure Sockets Layer.
Values:
  • true
  • false

action string
Default: getheaderonly

* GetHeaderOnly - Returns the message header information for all retrieved mail.
* GetAll - Returns mail. The information includes the message header information, message text, and any attachments. Set the AttachmentPath attribute to retrieve attachments.
* Delete - Deletes messages from a folder.
* Open - Initiates an open session or connection with the IMAP server.
* Close - Terminates the open session or connection with the IMAP server.
* MarkRead - Marks all messages read from a folder.
* DeleteFolder - Deletes the identified folder.
* CreateFolder - Creates a folder in Inbox.
* RenameFolder - Renames an existing user-defined folder.
* ListAllFolders - Displays a list of all existing folders in the mailbox or under the folder name defined by the Folder attribute.
* MoveMail - Moves mail from one folder to another
Values:
  • createfolder
  • open
  • close
  • getall
  • markread
  • listallfolders
  • getheaderonly
  • deletefolder
  • delete
  • renamefolder
  • movemail

timeout numeric

Specifies the number of seconds to wait before timing out connection to IMAP server. An error message is displayed when timeout occurs.

messageNumber string

Specifies the message number or a comma delimited list of message numbers for retrieval, deletion, marking mail as read, or moving mails.
If you set an invalid message number or range, then it is ignored. If you have specified the UID attribute, then MessageNumber attribute is ignored.

connection string

Required for the following actions: Open and Close - Specifies the variable name for the connection/session. For example, the e-mail login to an IMAP server can be used as the value for the connection. If the server attribute has an invalid IP address or invalid domain name,
then the connection fails and ColdFusion returns an error message.

newFolder string

Specifies the name of the destination folder where all mail move.

uid string

Specifies the unique ID or a comma-delimited list of Uids to retrieve or delete. If you set invalid Uids, then they are ignored.

folder string

For mail actions: Specifies the folder name where messages are searched, retrieved, moved, or deleted. If folder name is invalid, ColdFusion defaults to INBOX.
For folder actions: Specifies the folder name that is deleted (DeleteFolder) or created (CreateFolder) or renamed (RenameFolder).

port numeric

Specifies the IMAP port number. Use 993 for secured connections.

stoponerror boolean

Specifies whether or not to ignore the exceptions for this operation. When the value is true, it stops processing, displays an appropriate error.
Values:
  • true
  • false

generateUniqueFileNames boolean

Ensures that unique file names are generated for each attachment file.
The goal is to avoid name conflicts for attachments that have the same filename.
Values:
  • true
  • false

maxrows numeric

Specifies the number of rows to be marked as read, deleted, or moved across folders. When the value is 1, it signals the row determined by StartRow. Any incremental value marks rows starting from the StartRow.
If you have specified the UID or MessageNumber attribute, then MaxRows is ignored.

username string

Specifies the user name. Typically, the user name is same the e-mail login.

startRow numeric

Defines the first row number for reading or deleting. If you have specified the UID or MessageNumber attribute, then StartRow is ignored. You can also specify StartRow for moving mails.

attachmentpath string

Required for GetAll action - Specifies the name of the folder where ColdFusion retrieves attachments. If this folder does not exist, ColdFusion creates it.

server string

Specifies the IMAP server identifier. You can assign a host name or an IP address as the IMAP server identifier. For example, imap.gmail.com.

name string

Specifies the name for the query object that contains the retrieved message information.

recurse boolean

Specifies whether ColdFusion runs the CFIMAP command in subfolders.
Values:
  • true
  • false

Examples
Sample code using the cfimap tag

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub