Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-red-contrib-email

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-red-contrib-email - npm Package Compare versions

Comparing version 0.2.2 to 0.3.0

4

package.json
{
"name": "node-red-contrib-email",
"version": "0.2.2",
"version": "0.3.0",
"description": "SMTP email node for Node-RED",

@@ -21,3 +21,3 @@ "keywords": [

"dependencies": {
"nodemailer": "^6.9.9"
"nodemailer": "^6.9.12"
},

@@ -24,0 +24,0 @@ "node-red": {

@@ -45,3 +45,3 @@ # node-red-contrib-email

- **text** - The plaintext version of the message as an Unicode string, Buffer, Stream or an attachment-like object ({path: ‘/var/data/…'})
- **text** - The plaintext version of the message as an Unicode string, Buffer, Stream or an attachment-like object ({path: ‘/var/data/…'}). If you're sending a `msg.payload` of type number or boolean, then it is converted to string.
- **html** - The HTML version of the message as an Unicode string, Buffer, Stream or an attachment-like object ({path: ‘http://…'})

@@ -48,0 +48,0 @@ - **amp** - AMP4EMAIL specific HTML version of the message, same usage as with text and html. See AMP example below for usage or this [blogpost](https://blog.nodemailer.com/2019/12/30/testing-amp4email-with-nodemailer/) for sending and rendering.

@@ -12,5 +12,9 @@ module.exports = function (RED) {

secure: config.secure,
proxy: config.proxy || undefined
proxy: config.proxy || undefined,
});
node.transporter.on("error", (err)=> {
console.log("ERROR", err);
})
node.on("close", function (removed, done) {

@@ -22,2 +26,3 @@ done = done || function () {};

}
RED.nodes.registerType("email-transport", EmailTransport, {

@@ -60,5 +65,5 @@ credentials: {

return;
}
if(!firstInput) {
}
if (!firstInput) {
node.status({

@@ -72,4 +77,3 @@ fill: "green",

node.on("input", function (msg, send, done) {
node.sendEmail = async (msg, send, done) => {
firstInput = true;

@@ -86,7 +90,11 @@

const mail = {
from: m.from || config.from,
to: m.to || config.to,
cc: m.cc || config.cc,
from: m.from || config.from,
to: m.to || config.to,
cc: m.cc || config.cc,
bcc: m.bcc || config.bcc,
subject: m.subject || config.subject,
subject:
m.subject ||
config.subject ||
msg.topic ||
"Message from Node-RED",
attachments: m.attachments,

@@ -103,7 +111,32 @@ text: m.text,

} else {
mail.text = msg.payload;
// plain text message
// nodemailer is expecting a Unicode string, Buffer, Stream or an attachment-like object
if (
typeof msg.payload === "number" ||
typeof msg.payload === "boolean"
) {
mail.text = String(msg.payload);
} else {
mail.text = msg.payload;
}
}
transporter.sendMail(mail, function (err, info) {
if (err) {
transporter
.sendMail(mail)
.then((info) => {
delete msg.email;
msg.payload = info;
// increase success count
counter.success++;
node.status({
fill: "green",
shape: "dot",
text: `success ${counter.success}, error ${counter.error}`,
});
send(msg);
done();
})
.catch((err) => {
counter.error++;

@@ -116,22 +149,9 @@ node.status({

done(err);
return;
}
delete msg.email;
msg.payload = info;
// increase success count
counter.success++;
node.status({
fill: "green",
shape: "dot",
text: `success ${counter.success}, error ${counter.error}`,
});
};
send(msg);
done();
});
});
node.on("input", node.sendEmail);
}
RED.nodes.registerType("email-send", EmailSend);
};

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc