|
Summary
Appends a new message to an existing mailbox.
Syntax
| Int Append (Flags, MsgLength, Date, DestMailbox) |
|
Flags |
Long |
|
MsgLength |
Integer |
|
Date |
String |
|
DestMailbox |
String |
Description
The Append method appends a message to the destination mailbox. This method takes a message attribute flag (Flags), the length in bytes of the message to be appended
(MsgLength), the date for the message (Date) and a destination mailbox (DestMailbox).
The application can specify the attributes of the message in the Flags parameter. The Flags parameter can be set to 0 (no attributes), or a combination of the following values:
| IMAP_MSG_SEEN |
Message has been read |
| IMAP_MSG_ANSWERED |
Message has been answered |
| IMAP_MSG_FLAGGED |
Message is "flagged" for urgent/special attention |
| IMAP_MSG_DELETED |
Message has the deleted flag set |
| IMAP_MSG_DRAFT |
Message has not completed composition |
If the application wants to use a particular date and time then the Date parameter should contain that date and time, if this parameter is set to an empty string then by default the message
will contain the current date and time. The Date parameter format should be RFC822 compliant, for example the following is a valid date: "Sat, 18 July 1998 15:54 PST".
The MsgLength parameter should be set to the length of the entire message. If the application cannot determine the length of the message then the MsgLength parameter may be set to
1. In this case the IMAP ActiveX will first get all the data from the OnAppend event, and then determine the length, before sending the data to the IMAP server. However this is not as efficient and
the process may be slower than if the length was set by the application in the Append method.
The DestMailbox parameter should contain the name of the destination mailbox where the message will be appended.
The OnAppend event will be fired to get the message that is to be appended. The IMAP ActiveX control will keep firing the OnAppend event until the application sends an empty buffer with the Length
parameter set to 0.
Note that this method does not deliver the message, SMTP is used for delivering messages.
Return Value
If successful the Append method returns IMAP_SUCCESS. If it fails it fires the OnError event and returns one of the following errors:
ERR_IMAP_INVALID_HANDLE Invalid connection handle. A connection must be established before performing this action.
ERR_IMAP_FAILURE Host was not able to execute command.
ERR_IMAP_CANNOT_SEND_COMMAND Windows Sockets library was not able to accept outgoing data.
ERR_IMAP_TIMED_OUT Time out occurred while waiting for a response from host.
ERR_IMAP_IN_ACTION Another operation is already in progress.
ERR_IMAP_INVALID_ARGUMENT Invalid argument.
ERR_IMAP_ABORTED Operation was aborted and connection has been closed.
If this method returns ERR_IMAP_FAILURE, then the ImapReply property will contain the error message sent by the host which describes the reason why the command failed.
Example
Result = Imap.Append (IMAP_MSG_FLAGGED, Bytes, "", "ImapTest") If (Result = IMAP_SUCCESS) Then MsgBox "Message appended to mailbox.", 64, "Sample Program"
Exit Sub End If
|