imap to t-online works

This commit is contained in:
Tankred Hase 2013-08-02 12:52:38 +02:00
parent 90d0fdf504
commit 04e43bde3d
2 changed files with 40 additions and 31 deletions

View File

@ -2,19 +2,23 @@
var inbox = require('inbox');
var client = inbox.createConnection(false, "imap.gmail.com", {
secureConnection: true,
auth: {
XOAuth2: {
user: "safewithme.testuser@gmail.com",
clientId: "440907777130.apps.googleusercontent.com",
accessToken: "ya29.AHES6ZTVj9_kCdP8zEYCA9OZ6fvTqT_TmCe4UsmYPF3ffYM8eGHX2uw"
}
}
var client = inbox.createConnection(143, "imapmail.t-online.de", {
secureConnection: false,
// auth: {
// XOAuth2: {
// user: "safewithme.testuser@gmail.com",
// clientId: "440907777130.apps.googleusercontent.com",
// accessToken: "ya29.AHES6ZTVj9_kCdP8zEYCA9OZ6fvTqT_TmCe4UsmYPF3ffYM8eGHX2uw"
// }
// }
// auth: {
// user: "safewithme.testuser@gmail.com",
// pass: "hellosafe"
// }
auth: {
user: 'whiteout.test@t-online.de',
pass: '@6IyFg1SIlWH91Co' // 'R2nUXJlh9JKV3ZEp1#jH'
}
});
console.log("Connecting to server...");
@ -24,29 +28,34 @@ client.on("connect", function() {
console.log("Connected!");
// client.openMailbox("INBOX", function(error, mailbox) {
// if (error) throw error;
client.openMailbox("INBOX", function(error, mailbox) {
if (error) throw error;
// // List newest 10 messages
// client.listMessages(-10, function(err, messages) {
// console.log("Listing messages server...");
// messages.forEach(function(message) {
// console.log(message.UID);
// // client.createMessageStream(message.UID).pipe(process.stdout, {
// // end: false
// // });
// });
// List newest 10 messages
client.listMessages(-10, function(err, messages) {
console.log("Listing messages server...");
messages.forEach(function(message) {
console.log(message.UID);
// client.close();
// });
// });
var msgStream = client.createMessageStream(message.UID);
msgStream.on('data', function(chunk) {
console.log(chunk.toString('utf8'));
})
msgStream.on('end', function() {
console.log('\n\nthere will be no more data.');
});
});
client.close();
});
});
});
// client.on('error', function(err) {
// console.log('Error');
// console.log(err)
// });
client.on('error', function(err) {
console.log('Error');
console.log(err)
});
// client.on('close', function() {
// console.log('DISCONNECTED!');
// });
client.on('close', function() {
console.log('DISCONNECTED!');
});

View File

@ -9,7 +9,7 @@
},
"dependencies": {
"express": "~3.2.4",
"inbox": "https://github.com/whiteout-io/inbox/tarball/iconv-lite",
"inbox": "https://github.com/whiteout-io/inbox/tarball/chrome",
"nodemailer": "~0.4.3"
},
"devDependencies": {