Copies the specified messages from the currently selected folder to the specified folder.
true if the messages were copied successfully; otherwise, false.
To learn how to specify a valid message sequence (messageIndexSet value), see DownloadEnvelopes topic.
| Exception Type | Condition |
|---|---|
| MailBeeException | An error occurred and ThrowExceptions is true. |
This sample copies all messages from the inbox folder to the Sent folder.
The sample assumes "Sent" folder had already been created in the past. To learn how to make sure the folder exists, see UploadMessage or UploadMessage samples.
[C#] using System; using MailBee; using MailBee.ImapMail; class Sample { static void Main(string[] args) { Imap imp = new Imap(); // Connect to the server, login and select inbox. imp.Connect("imap.company.com"); imp.Login("jdoe@company.com", "secret"); imp.SelectFolder("INBOX"); // Copy all messages in Inbox into Sent. imp.CopyMessages(Imap.AllMessages, false, "Sent"); // Disconnect from the server. imp.Disconnect(); } }
[Visual Basic] Imports System Imports MailBee Imports MailBee.ImapMail Module Sample Sub Main() Dim imp As New Imap ' Connect to the server, login and select inbox. imp.Connect("imap.company.com") imp.Login("jdoe@company.com", "secret") imp.SelectFolder("INBOX") ' Copy all messages in Inbox into Sent. imp.CopyMessages(Imap.AllMessages, False, "Sent") ' Disconnect from the server. imp.Disconnect() End Sub End Module
Imap Class | MailBee.ImapMail Namespace | Imap.CopyMessages Overload List | MoveMessages