Last active
December 29, 2015 12:59
-
-
Save yorkie/7674668 to your computer and use it in GitHub Desktop.
a simple imap connector for fetching...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var tls = require('tls'); | |
var hostname = 'imap.qq.com'; | |
var port = 993; | |
var option = { | |
rejectUnauthorized: false | |
} | |
var cleartextStream = tls.connect(port, hostname, option); | |
var step = 0; | |
cleartextStream.setEncoding('utf8'); | |
cleartextStream.on('data', function (chunk) { | |
console.log(chunk); | |
switch (++step) { | |
case 1: | |
console.log('A1 CAPABILITY'); | |
cleartextStream.write('A1 CAPABILITY\n', 'binary'); break; | |
case 2: | |
console.log('A2 LOGIN "[email protected]" "Lyz15285115151"'); | |
cleartextStream.write('A2 LOGIN "[email protected]" "xxxxxxxxxx"\n', 'binary'); break; | |
case 3: | |
console.log('A3 CAPABILITY'); | |
cleartextStream.write('A3 CAPABILITY\n', 'binary'); break; | |
case 4: | |
console.log('A4 ID ("name" "inbox" "version" "1.0.0" "support-url" "http://yorkiefixer.me")') | |
cleartextStream.write('A4 ID ("name" "inbox" "version" "1.0.0" "support-url" "http://yorkiefixer.me")\n', 'binary'); break; | |
case 5: | |
console.log('A5 SELECT "INBOX"'); | |
cleartextStream.write('A5 SELECT "INBOX"\n', 'binary'); break; | |
case 6: | |
console.log('A6 FETCH *:* (UID ENVELOPE)'); | |
cleartextStream.write('A6 FETCH *:* (UID ENVELOPE)\n', 'binary'); break; | |
case 7: | |
break; | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is simple imap client in pure C: https://gist.github.com/yorkie/7886825