fetching a message over TSL/IMAP works

This commit is contained in:
Tankred Hase 2013-08-07 21:00:37 +02:00
parent 79b297e624
commit 472c4125ab
6 changed files with 43 additions and 28 deletions

24
gmail-test-proxy/build.js Normal file
View File

@ -0,0 +1,24 @@
'use strict';
var browserify = require('browserify'),
fs = require('fs'),
path = require('path');
var b = browserify('./imap-client.js');
b.require('net-chromeify', {
expose: 'net'
});
b.require('tls-chromeify', {
expose: 'tls'
});
b.bundle(function(err, src) {
if (err) {
throw err;
}
var file = path.join(__dirname + '/foo.js');
fs.writeFileSync(file, src);
console.log('bundle written to: ' + file);
});

View File

@ -6,6 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The Scripts -->
<script src="lib/forge.min.js"></script>
<script src="foo.js"></script>
</head>

View File

@ -1,13 +0,0 @@
var assert = require('assert'),
inbox = require("inbox");
describe('IMAP client', function() {
describe("Init", function() {
it('should work', function(done) {
});
});
});

View File

@ -2,8 +2,8 @@
var inbox = require('inbox');
var client = inbox.createConnection(143, "imapmail.t-online.de", {
secureConnection: false,
var client = inbox.createConnection(false, "imap.gmail.com", {
secureConnection: true,
// auth: {
// XOAuth2: {
// user: "safewithme.testuser@gmail.com",
@ -11,14 +11,14 @@ var client = inbox.createConnection(143, "imapmail.t-online.de", {
// accessToken: "ya29.AHES6ZTVj9_kCdP8zEYCA9OZ6fvTqT_TmCe4UsmYPF3ffYM8eGHX2uw"
// }
// }
// auth: {
// user: "safewithme.testuser@gmail.com",
// pass: "hellosafe"
// }
auth: {
user: 'whiteout.test@t-online.de',
pass: '@6IyFg1SIlWH91Co' // 'R2nUXJlh9JKV3ZEp1#jH'
user: "safewithme.testuser@gmail.com",
pass: "hellosafe"
}
// auth: {
// user: 'whiteout.test@t-online.de',
// pass: '@6IyFg1SIlWH91Co' // 'R2nUXJlh9JKV3ZEp1#jH'
// }
});
console.log("Connecting to server...");
@ -32,17 +32,17 @@ client.on("connect", function() {
if (error) throw error;
// List newest 10 messages
client.listMessages(-10, function(err, messages) {
client.listMessages(-1, function(err, messages) {
console.log("Listing messages server...");
messages.forEach(function(message) {
console.log(message.UID);
var msgStream = client.createMessageStream(message.UID);
msgStream.on('data', function(chunk) {
console.log(chunk.toString('utf8'));
console.log(chunk.toString('utf8'));
})
msgStream.on('end', function() {
console.log('\n\nthere will be no more data.');
console.log('\n\nthere will be no more data.');
});
});

1
gmail-test-proxy/lib/forge.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -8,13 +8,15 @@
"test": "grunt test && test/test.sh"
},
"dependencies": {
"express": "~3.2.4",
"inbox": "https://github.com/whiteout-io/inbox/tarball/chrome",
"net-chromeify": "https://github.com/whiteout-io/net-chromeify/tarball/rewrite",
"tls-chromeify": "https://github.com/whiteout-io/tls-chromeify/tarball/node-test",
"inbox": "https://github.com/whiteout-io/inbox/tarball/iconv-lite",
"nodemailer": "~0.4.3"
},
"devDependencies": {
"mocha": "~1.10.0",
"chai": "~1.6.0",
"browserify": "*",
"mocha": "~1.12.0",
"chai": "~1.7.2",
"grunt": "~0.4.1",
"grunt-contrib-jshint": "~0.5.3"
}