Node-RED Email Node — Complete Guide
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
- Non-exhaustive pattern matches that compile with warnings then crash at runtime
- Misunderstanding that
Stringis[Char]with poor performance for large text operations - Using
foldlinstead offoldl'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
DodaTech — emails that leave Node-RED and reach your inbox.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro