npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-red-contrib-email-dynamic

v1.0.1

Published

A Node-RED node to send emails. Both server settings and email details can be configured dynamically via the message payload.

Downloads

193

Readme

node-red-contrib-email-dynamic

Description

This Node-RED node allows you to send emails with dynamic SMTP server settings and attachments. The node is designed to be flexible, allowing you to specify SMTP server configurations and email content dynamically through the payload, or to use static configurations set in the node itself. This can be particularly useful for sending emails from within Node-RED flows with varying configurations.

Features

  • Dynamic SMTP Configuration: Supports setting SMTP server settings dynamically via message payload or through node configuration.

  • Dynamic Attachments: Allows adding multiple attachments to the email dynamically via message payload.

  • HTML and Text Support: Supports both plain text and HTML email content.

  • Flexible Authentication: Supports basic authentication with username and password, or OAuth tokens.

Installation

To install this node, use the Node-RED Palette Manager or install it directly via npm:

npm install node-red-contrib-email-dynamic

Usage

You can configure the email sending details directly in the node or pass them dynamically through the payload. The node supports sending attachments and using both text and HTML content.

Configuration

Node Properties

  • SMTP Server: SMTP server address (e.g., smtp.example.com).

  • SMTP Port: SMTP server port (e.g., 587).

  • SMTP User: SMTP authentication username.

  • SMTP Password: SMTP authentication password.

  • Secure: Set to true if using SSL/TLS, otherwise false.

  • TLS Options: Configure TLS options if required.

Flow Example

Here is an example of how to use this node in a Node-RED flow:

[
    {
        "id": "21e185dded19e0ef",
        "type": "email-dynamic",
        "z": "dfaf710c44ca5279",
        "name": "",
        "smtpServer": "",
        "smtpPort": "",
        "smtpUser": "",
        "smtpPass": "",
        "secure": false,
        "tlsRejectUnauthorized": false,
        "x": 1860,
        "y": 620,
        "wires": [
            []
        ]
    },
    {
        "id": "eb8d297e425e2b38",
        "type": "inject",
        "z": "dfaf710c44ca5279",
        "name": "input",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 1530,
        "y": 620,
        "wires": [
            [
                "23bc26edc4890059"
            ]
        ]
    },
    {
        "id": "23bc26edc4890059",
        "type": "function",
        "z": "dfaf710c44ca5279",
        "name": "send email data",
        "func": "var content = Buffer.from(\"Example Text file.\").toString('base64');\n\nmsg.smtp = {\n    host: \"\",  // SMTP-Server\n    port: 587,                   // SMTP-Port\n    auth: {\n        user: \"\",   // SMTP-Benutzername\n        pass: \"\"    // SMTP-Passwort\n    },\n    secure: false,               // True für SSL/TLS\n    tls: {\n        rejectUnauthorized: false // Setze auf true, wenn du eine Zertifikatsüberprüfung erzwingen möchtest\n    }\n};\n\n// E-Mail Details\nmsg.from = \"[email protected]\";       // Absenderadresse\nmsg.to = \"[email protected]\";     // Empfängeradresse\nmsg.subject = \"Betreff der E-Mail\";    // Betreff der E-Mail\nmsg.text = \"Das ist der E-Mail-Inhalt.\"; // Textinhalt der E-Mail\nmsg.attachments = [\n    {\n    \"filename\": \"example.txt\",\n    \"content\": content,\n    \"encoding\": \"base64\"\n}\n]\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1680,
        "y": 620,
        "wires": [
            [
                "21e185dded19e0ef"
            ]
        ]
    }
]

Troubleshooting

  • Attachment Issues: Ensure attachments are correctly formatted and encoded. Use Base64 encoding for binary files and proper text encoding for text files.

  • SMTP Errors: Verify SMTP server settings and authentication credentials. Ensure your server allows connections from your IP and the credentials are correct.

  • Debugging: Check Node-RED logs for detailed error messages. Enable debug logging for the email node to get more insight into issues.

License

This node is licensed under the MIT License.