Skip to content

Node-RED Email Node — Complete Guide

DodaTech Updated 2026-06-24 3 min read

In this tutorial, you'll learn about Node. We cover key concepts, practical examples, and best practices.

Hook

You configure the Email node in Node-RED to send notifications. You test it with an Inject node, and the debug sidebar shows "Message sent successfully." But the email never arrives in your inbox. Not in spam, not anywhere.

The Wrong Way

Using your Gmail password directly in the Email node config without an App Password causes Google to block the login as "Less secure app."

// BAD: Using Gmail password directly
{
    "server": "smtp.gmail.com",
    "port": 465,
    "secure": true,
    "username": "myemail@gmail.com",
    "password": "MyRealPassword123"
}
Email node: "Connected to SMTP server"
Gmail: "Sign-in blocked — Less secure app"
Email never sent — Google rejected authentication

Google no longer supports password-based SMTP authentication. You must use an App Password.

The Right Way

Use an App Password (Gmail) or SMTP relay with the correct configuration.

# 1. Generate a Gmail App Password
# Google Account → Security → 2-Step Verification → App Passwords
# Select "Mail" and your device → Copy the 16-character password
// CORRECT: Using App Password
{
    "server": "smtp.gmail.com",
    "port": 465,
    "secure": true,
    "username": "myemail@gmail.com",
    "password": "abcd efgh ijkl mnop"  // App Password (spaces OK)
}
# 2. Test with a simple inject
[Inject: timestamp] → [Email node]
Debug: "Message sent to recipient@example.com"
Inbox: Email received ✓
# 3. Check spam folder if not in inbox
# 4. For other providers, check SMTP settings:
# Outlook: smtp.office365.com:587 (STARTTLS)
# Yahoo: smtp.mail.yahoo.com:465 (SSL)
# Self-hosted: smtp.yourdomain.com:587 (STARTTLS)
# 5. Enable debug logging for email
# In settings.js:
logging: {
    console: {
        level: "debug"
    }
}
# Watch the SMTP conversation
journalctl -u node-red -f | grep -i "smtp\|email\|mail"

Prevention

  • Always use App Passwords for Gmail/Google Workspace SMTP.
  • Test email sending with a dedicated test flow before using in automations.
  • Check spam/junk folders during testing.
  • Set a descriptive "From" name so recipients recognise the sender.
  • Monitor email delivery with a bounce-back address or delivery receipts.

Common Mistakes with red email node

  1. Non-exhaustive pattern matches that compile with warnings then crash at runtime
  2. Misunderstanding that String is [Char] with poor performance for large text operations
  3. Using foldl instead of foldl' causing stack overflow on large lists

These mistakes appear frequently in real-world NODE code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

Can I send emails via SendGrid or Mailgun?

Yes — use their SMTP relay settings. SendGrid: smtp.sendgrid.net:587 with username apikey and the API key as the password. Mailgun uses your domain's SMTP credentials.

Why does the Email node say 'sent' but the email never arrives?

"Sent" means Node-RED delivered the message to the SMTP server. The server may have deferred, bounced, or spam-filtered it. Check the SMTP server logs or use a service with delivery tracking.

Can I send HTML emails with Node-RED?

Yes — set msg.payload to your HTML string and add msg.envelope = {"contentType": "text/html"} before the Email node. The email will be sent as HTML instead of plain text.


DodaTech — emails that leave Node-RED and reach your inbox.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro