admin管理员组

文章数量:1337212

I am using imap package in my project I have read the documentation and I found this for searching in email with date.

imap.search([ 'UNSEEN', ['SINCE', 'May 20, 2010'] ], function(err, results) {
});

I want to search email between two dates for example May 20, 2010 to May 28,2010.

So it possible to find between dates in imap protocol ?

I am using imap package in my project I have read the documentation and I found this for searching in email with date.

imap.search([ 'UNSEEN', ['SINCE', 'May 20, 2010'] ], function(err, results) {
});

I want to search email between two dates for example May 20, 2010 to May 28,2010.

So it possible to find between dates in imap protocol ?

Share Improve this question asked May 20, 2014 at 10:02 Waqas AhmedWaqas Ahmed 4931 gold badge5 silver badges24 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 9

Can you give reference to the module you refer to?

If you are using mscdex/node-imap, you can refer to

'BEFORE' - Messages whose internal date (disregarding time and timezone) is earlier than the specified date.

'SINCE' - Messages whose internal date (disregarding time and timezone) is within or later than the specified date.

in its API documentation https://github./mscdex/node-imap/blob/master/README.md#API

search(< array >criteria, < function >callback) - (void)

so to sum up

imap.search([ 'UNSEEN', ['SINCE', 'May 20, 2010'], ['BEFORE', 'May 28, 2010'] ],
    function(err, results) {
});

is what you want ...

本文标签: javascriptSearching email in imap NodejsStack Overflow