We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to get mailqurey buider user C# class

how to get mailqurey buider user C# class

Filtering Messages from POP3 Mailbox Based on Sender, Recipient or Date

http://www.aspose.com/docs/display/emailnet/Filtering+Messages+from+POP3+Mailbox+Based+on+Sender,+Recipient+or+Date

this page how to use MailQueryBuilder builder = new MailQueryBuilder();


This message was posted using Email2Forum by Tahir Manzoor.

Hi,


Thank you for considering Aspose.Email.

Could you please elaborate your requirements a little more. The MailQueryBuilder class can be initiated as a new object and then can be used as per requirements. Please have a look at the following code sample for your kind reference and let us know your feedback if this isn’t helpful to you.

Sample Code:

// Connect and log in to POP3
const string host = “host”;
const int port = 110;
const string username = "user@host.com";
const string password = “password”;
Pop3Client client = new Pop3Client(host, port, username, password);

// Set conditions
MailQueryBuilder builder = new MailQueryBuilder();
// Subject contains “Newsletter”
builder.Subject.Contains(“Newsletter”);
// Emails that arrived today
builder.InternalDate.On(DateTime.Now);
// Build the query
MailQuery query = builder.GetQuery();

// Get list of messages
Pop3MessageInfoCollection messages = client.ListMessages(query);
Console.WriteLine(“Pop3: " + messages.Count + " message(s) found.”);

// Disconnect from POP3
client.Disconnect();