emailjs / emailjs-imap-handler Goto Github PK
View Code? Open in Web Editor NEWParse and compile IMAP commands
Parse and compile IMAP commands
1.18.5
to 1.18.6
.This version is covered by your current version range and after updating it in your project the build failed.
nodemon is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
The new version differs by 1 commits.
521eb1e
fix: restart on change for non-default signals (#1409) (#1430)
See the full diff
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
Felix is not actively maintaining this library anymore. But this is the only IMAP client for JS that I am aware of, so I feel this library still has its value. Please let me know if you're interested in helping out, either via email or open an issue about that.
The work that's on the horizon is:
My app is crashing every time the handler meets an unexpected character. Is there something I'm missing about handling errors? Here's the error stack:
/home/alex/poste/node_modules/wo-imap-handler/src/imap-parser.js:86
throw new Error("Unexpected char at position " + (this.pos + e
^
Error: Unexpected char at position 4
at ParserInstance.getElement (/home/alex/poste/node_modules/wo-imap-handler/src/imap-parser.js:86:23)
at ParserInstance.getTag (/home/alex/poste/node_modules/wo-imap-handler/src/imap-parser.js:44:29)
at Object.parser (/home/alex/poste/node_modules/wo-imap-handler/src/imap-parser.js:590:31)
at parse (/home/alex/poste/lib/commands.js:11:18)
at Object.exports.process (/home/alex/poste/lib/commands.js:21:2)
at CleartextStream.<anonymous> (/home/alex/poste/lib/imap.js:23:14)
at CleartextStream.emit (events.js:95:17)
at CleartextStream.<anonymous> (_stream_readable.js:765:14)
at CleartextStream.emit (events.js:92:17)
at emitReadable_ (_stream_readable.js:427:10)
Hi there,
using the browserbox
package I get the following error when I execute client.selectMailbox('INBOX', function(err, mailbox) { ... }
:
[2014-10-03T20:11:36.088Z][browserbox IMAP] error parsing imap response: Error: Unexpected end of input at position 202[PERMANENTFLAGS (\Answered \Flagged \Draft \Deleted \Seen reading $has_cal NonJunk Junk de:hacking $label2 $Phishing $Forwarded easter $label1 tagit $MDNSent followup kt-evalution ostern [css3-page]
Error: Unexpected end of input at position 202
at TokenParser.<anonymous> (/Some/Path/node_modules/browserbox/node_modules/wo-imap-handler/src/imap-parser.js:153:23)
at /Some/Path/node_modules/browserbox/node_modules/wo-imap-handler/src/imap-parser.js:195:17
at Array.forEach (native)
at TokenParser.<anonymous> (/Some/Path/node_modules/browserbox/node_modules/wo-imap-handler/src/imap-parser.js:194:29)
at /Some/Path/node_modules/browserbox/node_modules/wo-imap-handler/src/imap-parser.js:195:17
at Array.forEach (native)
at TokenParser.<anonymous> (/Some/Path/node_modules/browserbox/node_modules/wo-imap-handler/src/imap-parser.js:194:29)
at TokenParser.getAttributes (/Some/Path/node_modules/browserbox/node_modules/wo-imap-handler/src/imap-parser.js:200:9)
at ParserInstance.getAttributes (/Some/Path/node_modules/browserbox/node_modules/wo-imap-handler/src/imap-parser.js:120:78)
at Object.parser (/Some/Path/node_modules/browserbox/node_modules/wo-imap-handler/src/imap-parser.js:605:42)
raw:* OK [PERMANENTFLAGS (\Answered \Flagged \Draft \Deleted \Seen reading $has_cal NonJunk Junk de:hacking $label2 $Phishing $Forwarded easter $label1 tagit $MDNSent followup kt-evalution ostern [css3-page] JunkRecorded $NotJunk NotJunk $NotPhishing $Junk \*)] Flags permitted.
From a guess I would say the [css3-page]
screws up the parser as it is expecting to find the closing ]
at the very end of the message, could that be?
Any idea how this could be fixed?
For completeness, this is the complete code I execute to get the above error:
var BrowserBox = require('browserbox');
var login = require('./login.js');
var client = new BrowserBox('imap.gmail.com', 993, {
auth: login,
id: {
name: 'My Client',
version: '0.1'
}
});
client.onerror = function(err){ console.error(err); }
client.onclose = function(err){ console.error(err); }
client.onauth = function() {
client.selectMailbox('INBOX', function(err, mailbox) {
console.log(err || mailbox);
});
}
// Connect to the server.
client.connect();
If I only send a tag, such as "asdf", through the parser, it results in an error:
Unexpected char at position 4
I am triming my strings and removing all bad characters.
Instead of throwing an error, the parser should return an Object as it does if I include a command ("asdf LOGIN"), such as {"tag": "asdf"}.
The fromCharCode
function does work well at all times. I'd recommend using a cross compatible converter like http://www.onicos.com/staff/iz/amuse/javascript/expert/utf.txt
When using Airmail account the root folder name is enclosed in brackets: "[Airmail]".
Trying to connect to such an account gives error:
Unexpected section start char [ at position 7
at emailjs-imap-parser.js (422)
Putting in a debug log to log out the command that is failing reveals:
(\HasChildren) "." Trash.[Airmail]
I am issuing a query for multiple body parts, basically something like this:
t uid fetch 585599 (body.peek[1.1] body.peek[1.2])
This results in a response like this:
* 126015 FETCH (UID 585599 BODY[1.2] {0}
BODY[1.1] {0}
)
t OK Success
This is the correct response, since the message has two alternative message bodies, both of which are empty. But imapHandler.parser() throws a parsing error when passing it the following string:
* 126015 FETCH (UID 585599 BODY[1.2] {0}\r\n BODY[1.1] {0}
I have not dug any deeper at this point.
Hi, I am having issues with my email client. Some users report garbled characters on their ends. Most of these users have non-standard text values. I have managed to reproduce the issue, but not sure how to tackle it. I saw some other tickets suggesting to use different methods, but they did not provide an example.
Here is a git with my issue:
https://github.com/maksimlya/emailjs-imap-handler-garbled-example
Can:
git clone
npm i
npm start
put a breakpoint at
console.log(res);
and see the 'Subject' text is garbled, altho I could read it correctly using TextDecoder.
This is the result I get from 'TextDecoder().decode(testVal):
* 17 FETCH (UID 27 BODY[HEADER.FIELDS (FROM TO CC BCC SUBJECT REPLY-TO MESSAGE-ID REFERENCES IN-REPLY-TO X-WELCOME X-WELCOME-EMAIL X-SSHIDE X-SSSINGLEHIDE DISPOSITION-NOTIFICATION-TO X-CONFIRM-READING-TO RETURN-RECEIPT-TO X-PRIORITY IMPORTANCE)] {81}\r\nFrom: [email protected]\nTo: [email protected]\nSubject: テストメール\n\r\n)
And this is the counter-part of that value after using parse function from this lib:
From: [email protected]\nTo: [email protected]\nSubject: ������\n\r\n
Any advice / solution?
I've tried to convert the Uint8Array to string, then converting it back with the 'suggested' method of using 'fromCharCode(0)', but that resulted with other errors of 'Unexpected char at position x', so I'm not quite sure what to do.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.