Dart.Mail Namespace > Mailbox Class > Get Method : Get() Method |
Public Overloads Function Get() As ImapMessage()
Dim instance As Mailbox Dim value() As ImapMessage value = instance.Get()
public ImapMessage[] Get()
public: ImapMessage*[]* Get();
public: array<ImapMessage^>^ Get();
Exception | Description |
---|---|
ProtocolException | Bad IMAP protocol response received from server. |
/// <summary> /// Downloads each message in the current mailbox and saves it to the specified directory. /// </summary> /// <param name="myImap">A connected and authenticated Imap instance, that has a mailbox selected.</param> /// <param name="downloadFolder">The directory to save the emails in.</param> public void GetMessagesInterleaved(Imap myImap, string downloadFolder) { foreach (ImapMessage message in myImap.SelectedMailbox.ToArray()) { //Confirm that the message in the copied array wasn't deleted by another client if (message.Id != 0) { message.Get(); message.Message.Save(Path.Combine(downloadFolder, message.Uid + ".eml")); } } } /// <summary> /// Downloads all messages in the current mailbox and then saves them to the specified directory. /// </summary> /// <param name="myImap">A connected and authenticated Imap instance, that has a mailbox selected.</param> /// <param name="downloadFolder">The directory to save the emails in.</param> public void GetMessages(Imap myImap, string downloadFolder) { ImapMessage[] messages = myImap.SelectedMailbox.Get(); foreach (ImapMessage message in messages) message.Message.Save(Path.Combine(downloadFolder, message.Uid + ".eml")); }
''' <summary> ''' Downloads each message in the current mailbox and saves it to the specified directory. ''' </summary> ''' <param name="myImap">A connected and authenticated Imap instance, that has a mailbox selected.</param> ''' <param name="downloadFolder">The directory to save the emails in.</param> Public Sub GetMessagesInterleaved(ByVal myImap As Imap, ByVal downloadFolder As String) For Each message As ImapMessage In myImap.SelectedMailbox.ToArray() 'Confirm that the message in the copied array wasn't deleted by another client If message.Id <> 0 Then message.Get() message.Message.Save(Path.Combine(downloadFolder, message.Uid & ".eml")) End If Next message End Sub ''' <summary> ''' Downloads all messages in the current mailbox and then saves them to the specified directory. ''' </summary> ''' <param name="myImap">A connected and authenticated Imap instance, that has a mailbox selected.</param> ''' <param name="downloadFolder">The directory to save the emails in.</param> Public Sub GetMessages(ByVal myImap As Imap, ByVal downloadFolder As String) Dim messages() As ImapMessage = myImap.SelectedMailbox.Get() For Each message As ImapMessage In messages message.Message.Save(Path.Combine(downloadFolder, message.Uid & ".eml")) Next message End Sub