mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
email node - put description before attached file.
This commit is contained in:
parent
d86cf60b06
commit
47520ea5aa
@ -90,12 +90,13 @@ module.exports = function(RED) {
|
||||
if ((msg.payload[0] === 0x89)&&(msg.payload[1] === 0x50)) { fe = "png"; } //4E
|
||||
msg.filename = "attachment."+fe;
|
||||
}
|
||||
sendopts.attachments = [ { content: msg.payload, filename:(msg.filename.replace(/^.*[\\\/]/, '') || "file.bin") } ];
|
||||
var fname = msg.filename.replace(/^.*[\\\/]/, '') || "file.bin";
|
||||
sendopts.attachments = [ { content:msg.payload, filename:fname } ];
|
||||
if (msg.hasOwnProperty("headers") && msg.headers.hasOwnProperty("content-type")) {
|
||||
sendopts.attachments[0].contentType = msg.headers["content-type"];
|
||||
}
|
||||
// Create some body text..
|
||||
sendopts.text = RED._("email.default-message",{filename:(msg.filename.replace(/^.*[\\\/]/, '') || "file.bin"),description:(msg.hasOwnProperty("description") ? "\n\n"+msg.description : "")});
|
||||
sendopts.text = RED._("email.default-message",{filename:fname, description:(msg.description||"")});
|
||||
}
|
||||
else {
|
||||
var payload = RED.util.ensureString(msg.payload);
|
||||
|
@ -13,10 +13,7 @@
|
||||
"useSSL": "Use SSL?",
|
||||
"disposition": "Disposition"
|
||||
},
|
||||
|
||||
"default-message": "Your file from Node-RED is attached: __filename__ __description__",
|
||||
|
||||
|
||||
"default-message": "__description__\n\nFile from Node-RED is attached: __filename__",
|
||||
"tip": {
|
||||
"cred": "<b>Note:</b> Copied credentials from global emailkeys.js file.",
|
||||
"recent": "Tip: Only retrieves the single most recent email."
|
||||
@ -39,7 +36,7 @@
|
||||
"nopassword": "No e-mail password set",
|
||||
"nocredentials": "No Email credentials found. See info panel.",
|
||||
"nosmtptransport": "No SMTP transport. See info panel.",
|
||||
"nopayload": "No payload to send",
|
||||
"nopayload": "No payload to send",
|
||||
"fetchfail": "Failed to fetch folder: __folder__",
|
||||
"messageerror": "Fetch message error: __error__"
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "node-red-node-email",
|
||||
"version": "0.1.21",
|
||||
"version": "0.1.22",
|
||||
"description": "Node-RED nodes to send and receive simple emails",
|
||||
"dependencies": {
|
||||
"nodemailer": "^1.11.0",
|
||||
|
Loading…
Reference in New Issue
Block a user