Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Bump version

  • Loading branch information...
commit 91a6d4ddb8e49d54f7e893bc37adfc9956ddb6c8 1 parent d413e2a
Andris Reinman andris9 authored
Showing with 45 additions and 2 deletions.
  1. +37 −0 README.md
  2. +7 −1 examples/list.js
  3. +1 −1  package.json
37 README.md
View
@@ -260,6 +260,43 @@ Example output for a message listing
in the message object - for example, if there are no "cc:" addresses listed,
there is no "cc" field in the message object
+### Listing flags
+
+As a shorthand listing, you can also list only UID and Flags pairs
+
+ client.listFlags(from[, limit], callback)
+
+Where
+
+ * **from** is the index of the first message (0 based), you can use negative numbers to count from the end (-10 indicates the 10 last messages)
+ * **limit** defines the maximum count of messages to fetch, if not set or 0 all messages from the starting position will be included
+ * **callback** *(error, messages)* is the callback function to run with the message array
+
+Example
+
+ // list flags for newest 10 messages
+ client.listFlags(-10, function(err, messages){
+ messages.forEach(function(message){
+ console.log(message.UID, message.flags);
+ });
+ });
+
+Example output for a message listing
+
+ [
+ {
+ // if uidvalidity changes, all uid values are void!
+ UIDValidity: '664399135',
+
+ // uid value of the message
+ UID: 52,
+
+ // message flags (Array)
+ flags: [ '\\Flagged', '\\Seen' ]
+ },
+ ...
+ ]
+
### Fetch message details
To fetch message data (flags, title, etc) for a specific message, use
8 examples/list.js
View
@@ -7,7 +7,7 @@ var client = inbox.createConnection(false, "imap.gmail.com", {
user: "test.nodemailer@gmail.com",
pass: "Nodemailer123"
},
- debug: false
+ debug: true
});
client.connect();
@@ -24,6 +24,12 @@ client.on("connect", function(){
messages.forEach(function(message){
console.log(message.UID+": "+message.title);
});
+
+ client.listFlags(-10, function(err, messages){
+ messages.forEach(function(message){
+ console.log(message);
+ });
+ });
});
});
2  package.json
View
@@ -1,6 +1,6 @@
{
"name": "inbox",
- "version": "0.1.27",
+ "version": "0.1.28",
"author" : "Andris Reinman",
"maintainers":[
{
Please sign in to comment.
Something went wrong with that request. Please try again.