mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
email node - remove promises for node8
and fixup tests
This commit is contained in:
parent
ffa5761756
commit
6f351943cb
@ -529,11 +529,9 @@ module.exports = function(RED) {
|
|||||||
disabledCommands: ['AUTH', 'STARTTLS'],
|
disabledCommands: ['AUTH', 'STARTTLS'],
|
||||||
|
|
||||||
onData: function (stream, session, callback) {
|
onData: function (stream, session, callback) {
|
||||||
simpleParser(stream, {
|
simpleParser(stream, { skipTextToHtml:true, skipTextLinks:true }, (err, parsed) => {
|
||||||
skipTextToHtml: true,
|
if (err) { node.error(RED._("email.errors.parsefail"),err); }
|
||||||
skipTextLinks: true
|
else {
|
||||||
})
|
|
||||||
.then(parsed => {
|
|
||||||
node.status({fill:"green", shape:"dot", text:""});
|
node.status({fill:"green", shape:"dot", text:""});
|
||||||
var msg = {}
|
var msg = {}
|
||||||
msg.payload = parsed.text;
|
msg.payload = parsed.text;
|
||||||
@ -557,9 +555,9 @@ module.exports = function(RED) {
|
|||||||
else { msg.attachments = []; }
|
else { msg.attachments = []; }
|
||||||
node.send(msg); // Propagate the message down the flow
|
node.send(msg); // Propagate the message down the flow
|
||||||
setTimeout(function() { node.status({})}, 500);
|
setTimeout(function() { node.status({})}, 500);
|
||||||
})
|
}
|
||||||
.catch(err => { node.error(RED._("email.errors.parsefail"),err); })
|
callback();
|
||||||
.finally(callback);
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "node-red-node-email",
|
"name": "node-red-node-email",
|
||||||
"version": "1.8.0",
|
"version": "1.8.1",
|
||||||
"description": "Node-RED nodes to send and receive simple emails.",
|
"description": "Node-RED nodes to send and receive simple emails.",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"imap": "^0.8.19",
|
"imap": "^0.8.19",
|
||||||
|
@ -225,6 +225,7 @@ describe('email Node', function () {
|
|||||||
|
|
||||||
n2.on("input", function(msg) {
|
n2.on("input", function(msg) {
|
||||||
//console.log("GOT",msg);
|
//console.log("GOT",msg);
|
||||||
|
try {
|
||||||
msg.should.have.a.property("payload",'Hello World\n');
|
msg.should.have.a.property("payload",'Hello World\n');
|
||||||
msg.should.have.a.property("topic","Test");
|
msg.should.have.a.property("topic","Test");
|
||||||
msg.should.have.a.property("from",'foo@example.com');
|
msg.should.have.a.property("from",'foo@example.com');
|
||||||
@ -232,6 +233,10 @@ describe('email Node', function () {
|
|||||||
msg.should.have.a.property("attachments");
|
msg.should.have.a.property("attachments");
|
||||||
msg.should.have.a.property("header");
|
msg.should.have.a.property("header");
|
||||||
done();
|
done();
|
||||||
|
}
|
||||||
|
catch(e) {
|
||||||
|
done(e)
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
n3.emit("input", {
|
n3.emit("input", {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user