IMAPRecvMessage

Command group Flag affected Reversible Execute on client Platform(s)
External commands YES NO NO All

Syntax

IMAPRecvMessage (socket,messageuid,message[,stsproc,responselist]) Returns status

Description

Note: The flag is set according to whether Omnis was able to make a call to this external command.

This Web command is multi-threaded, allowing another thread to execute in the multi-threaded server while it runs. Note that the same socket cannot safely be used concurrently by more than one thread.

IMAPRecvMessage receives a specified message in the currently selected mailbox. The received message is in RFC 822 format. You can pass the received message to the MailSplit command, in order to parse it.

Before using this command, you must select a mailbox using the IMAPSelectMailbox command

Socket is an Omnis Long Integer field containing a socket opened to an IMAP server using IMAPConnect.

Messageuid is an Omnis Long Integer field containing the IMAP Unique Identifier (UID) of the message to be retrieved.

Message is an Omnis Binary or Character field which receives the RFC 822 format message. For correct results with many of the encodings supported by MailSplit you must receive into a Binary field.

Stsproc is an optional parameter containing the name of an Omnis method that this command calls with status messages. This command calls the method with no parameters, and the status information in the variable #S1. The status information logs protocol messages exchanged on the connection to the server.

Responselist is an optional parameter into which this command places response lines received from the IMAP server. Before calling this command, define the responselist to have a single Character column. When the command returns successfully, the response list contains the untagged and tagged responses received from the IMAP server as a result of executing this command. These sometimes include unsolicited information, for example, an update on the current number of messages in the selected mailbox. Each line in the response list is a response line received from the server. See RFC 3501 for more details, if you need to handle this sort of information.

This command returns an integer, which is less than zero if an error occurred. Possible error codes are listed in the Web Command Error Codes Appendix.

Example

# Receive message with UID 142 in the currently selected mailbox
Calculate iUID as 142
IMAPRecvMessage (iIMAPSocket,iUID,lMessageReturns lStatus
If lStatus<0
  # Command failed
End If