Dart.Mail Namespace > ImapSearchParameter Class > ImapSearchParameter Constructor : ImapSearchParameter Constructor(ImapCriterion,String) |
Public Function New( _ ByVal criterion As ImapCriterion, _ ByVal parameter As String _ )
Dim criterion As ImapCriterion Dim parameter As String Dim instance As New ImapSearchParameter(criterion, parameter)
public ImapSearchParameter( ImapCriterion criterion, string parameter )
public: ImapSearchParameter( ImapCriterion criterion, string* parameter )
public: ImapSearchParameter( ImapCriterion criterion, String^ parameter )
Creates a new instance of ImapSearchParameter, setting ImapSearchParameter.Criterion to criterion and ImapSearchParameter.Parameter to parameter.
private void getMessages(object state) { //Configure server and account info imap1.Session.RemoteEndPoint = new Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session)); imap1.Session.Username = myUsername; imap1.Session.Password = myPassword; //Connect and log into the account imap1.Connect(); imap1.Authenticate(); //Set the selected mailbox to the Inbox imap1.SelectedMailbox = imap1.Mailboxes["INBOX"]; // Construct the search "SEARCH SINCE 1-Jan-2012 NOT FROM JACKSON" ImapSearchParameter[] criteria = new ImapSearchParameter[] { new ImapSearchParameter(ImapCriterion.Since, "1-Jan-2012"), new ImapSearchParameter(ImapCriterion.Not, ""), new ImapSearchParameter(ImapCriterion.From, "JACKSON") }; // Perform the search ImapMessage[] messages = imap1.SelectedMailbox.Search(criteria); //Copy all messages that meet the criteria to the 'Save' mailbox foreach (ImapMessage imapMessage in messages) imapMessage.CopyTo(imap1.Mailboxes["Save"]); //Gracefully logout imap1.Close(); }
Private Sub getMessages(ByVal state As Object) 'Configure server and account info imap1.Session.RemoteEndPoint = New Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session)) imap1.Session.Username = myUsername imap1.Session.Password = myPassword 'Connect and log into the account imap1.Connect() imap1.Authenticate() 'Set the selected mailbox to the Inbox imap1.SelectedMailbox = imap1.Mailboxes("INBOX") ' Construct the search "SEARCH SINCE 1-Jan-2012 NOT FROM JACKSON" Dim criteria() As ImapSearchParameter = { New ImapSearchParameter(ImapCriterion.Since, "1-Jan-2012"), New ImapSearchParameter(ImapCriterion.Not, ""), New ImapSearchParameter(ImapCriterion.From, "JACKSON") } ' Perform the search Dim messages() As ImapMessage = imap1.SelectedMailbox.Search(criteria) 'Copy all messages that meet the criteria to the 'Save' mailbox For Each imapMessage As ImapMessage In messages imapMessage.CopyTo(imap1.Mailboxes("Save")) Next imapMessage 'Gracefully logout imap1.Close() End Sub