Let email node be able to send blank topic

and let msg.description be " also
to close #959
This commit is contained in:
Dave Conway-Jones
2022-11-08 13:52:37 +00:00
parent 4c0ecc70bc
commit c3a5716fe7
5 changed files with 9 additions and 7 deletions

View File

@@ -98,7 +98,8 @@ module.exports = function(RED) {
sendopts.headers = msg.headers;
sendopts.priority = msg.priority;
}
sendopts.subject = msg.topic || msg.title || "Message from Node-RED"; // subject line
if (msg.hasOwnProperty("topic") && msg.topic === '') { sendopts.subject = ""; }
else { sendopts.subject = msg.topic || msg.title || "Message from Node-RED"; } // subject line
if (msg.hasOwnProperty("header") && msg.header.hasOwnProperty("message-id")) {
sendopts.inReplyTo = msg.header["message-id"];
sendopts.subject = "Re: " + sendopts.subject;
@@ -119,7 +120,8 @@ module.exports = function(RED) {
sendopts.attachments[0].contentType = msg.headers["content-type"];
}
// Create some body text..
sendopts.text = RED._("email.default-message",{filename:fname, description:(msg.description||"")});
if (msg.hasOwnProperty("description")) { sendopts.text = msg.description; }
else { sendopts.text = RED._("email.default-message",{filename:fname}); }
}
else {
var payload = RED.util.ensureString(msg.payload);