mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
parent
c0c6d75535
commit
14983c9722
@ -120,7 +120,18 @@ module.exports = function(RED) {
|
||||
var payload = RED.util.ensureString(msg.payload);
|
||||
sendopts.text = payload; // plaintext body
|
||||
if (/<[a-z][\s\S]*>/i.test(payload)) { sendopts.html = payload; } // html body
|
||||
if (msg.attachments) { sendopts.attachments = msg.attachments; } // add attachments
|
||||
if (msg.attachments && Array.isArray(msg.attachments)) {
|
||||
sendopts.attachments = msg.attachments;
|
||||
for (var a=0; a < sendopts.attachments.length; a++) {
|
||||
if (sendopts.attachments[a].hasOwnProperty("content")) {
|
||||
if (typeof sendopts.attachments[a].content !== "string" && !Buffer.isBuffer(sendopts.attachments[a].content)) {
|
||||
node.error(RED._("email.errors.invalidattachment"),msg);
|
||||
node.status({fill:"red",shape:"ring",text:"email.status.sendfail"});
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
smtpTransport.sendMail(sendopts, function(error, info) {
|
||||
if (error) {
|
||||
|
@ -60,7 +60,8 @@
|
||||
"fetchfail": "Failed to fetch folder: __folder__",
|
||||
"parsefail": "Failed to parse message",
|
||||
"messageerror": "Fetch message error: __error__",
|
||||
"refreshtoolarge": "Refresh interval too large. Limiting to 2147483 seconds"
|
||||
"refreshtoolarge": "Refresh interval too large. Limiting to 2147483 seconds",
|
||||
"invalidattachment": "Invalid attachment content. Must be String or buffer"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
{
|
||||
"name": "node-red-node-email",
|
||||
"version": "1.8.2",
|
||||
"version": "1.8.3",
|
||||
"description": "Node-RED nodes to send and receive simple emails.",
|
||||
"dependencies": {
|
||||
"imap": "^0.8.19",
|
||||
"poplib": "^0.1.7",
|
||||
"mailparser": "^3.0.0",
|
||||
"nodemailer": "~6.4.10",
|
||||
"smtp-server": "^3.7.0"
|
||||
"mailparser": "^3.0.1",
|
||||
"nodemailer": "~6.4.17",
|
||||
"smtp-server": "^3.8.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
Loading…
Reference in New Issue
Block a user