CreateMessage Method  

Create a new message.


object.CreateMessage( MessageData, [MessageFlags], [MailboxName] )


The contents of the message to be created. This may either be specified as a string or as an array of bytes.
An optional integer value which specifies one or more message flags. This parameter is constructed by using a bitwise operator with any of the following values:
Value Constant Description
0 imapFlagNone No value.
1 imapFlagAnswered The message has been answered.
2 imapFlagDraft The message is not completed and is marked as a draft copy.
4 imapFlagUrgent The message is flagged for urgent or special attention.
8 imapFlagSeen The message has been read.
An optional string argument which specifies the name of the mailbox that the message will be created in. If this argument is omitted, the message will be created in the currently selected mailbox.

Return Value

A value of zero is returned if the method succeeds. Otherwise, a non-zero error code is returned which indicates the cause of the failure.


The CreateMessage method creates a new message, appending it to the contents of the specified mailbox. This method will cause the current thread to block until the message transfer completes, a timeout occurs or the transfer is canceled. During the transfer, the OnProgress event will fire periodically, enabling the application to update any user interface objects such as a progress bar.

See Also

GetMessage Method, OnProgress Event