[{"data":1,"prerenderedAt":638},["ShallowReactive",2],{"node-red-\u002Fnode-red\u002Fnotification\u002Femail":3},{"id":4,"title":5,"body":6,"description":630,"extension":631,"meta":632,"navigation":633,"path":634,"seo":635,"stem":636,"__hash__":637},"nodeRed\u002Fnode-red\u002Fnotification\u002Femail.md","Sending and receiving emails with Node-RED",{"type":7,"value":8,"toc":606},"minimark",[9,17,21,26,29,58,62,84,88,93,108,113,133,137,140,145,165,170,196,200,203,209,213,216,236,240,243,247,250,264,268,271,321,325,333,341,362,366,413,421,425,467,474,478,504,511,515,522,529,532,536,540,543,561,565,568],[10,11,13],"h1",{"id":12},"",[14,15],"binding",{"value":16},"meta.title",[18,19,20],"p",{},"This guide shows you how to integrate email with Node-RED for sending and receiving messages. You'll learn how to configure email nodes, set up Gmail integration, and follow best practices to ensure your notifications reach their destination.",[22,23,25],"h2",{"id":24},"when-to-use-email-for-iot-notifications","When to Use Email for IoT Notifications",[18,27,28],{},"Email offers unique advantages that make it suitable for specific notification scenarios:",[30,31,32,40,46,52],"ul",{},[33,34,35,39],"li",{},[36,37,38],"strong",{},"Non-urgent notifications"," - Email works well for updates that don't require immediate action, allowing users to review them at their convenience.",[33,41,42,45],{},[36,43,44],{},"Compliance and audit trails"," - Email provides documented communication records that are essential for regulatory compliance and audit requirements.",[33,47,48,51],{},[36,49,50],{},"Detailed information"," - Email supports attachments and longer content, making it useful for sharing reports, logs, and comprehensive documentation.",[33,53,54,57],{},[36,55,56],{},"Multiple recipients"," - Email can deliver notifications to several users simultaneously, ensuring information reaches everyone who needs it.",[22,59,61],{"id":60},"installing-the-email-node","Installing the Email Node",[63,64,65,68,71,74,81],"ol",{},[33,66,67],{},"Open Node-RED Settings (top-right menu)",[33,69,70],{},"Select \"Manage Palette\"",[33,72,73],{},"Go to the \"Install\" tab",[33,75,76,77],{},"Search for ",[78,79,80],"code",{},"node-red-node-email",[33,82,83],{},"Click \"Install\"",[22,85,87],{"id":86},"understanding-email-node-configuration","Understanding Email Node Configuration",[89,90,92],"h3",{"id":91},"server","Server",[18,94,95,96,99,100,103,104,107],{},"The server address determines where your emails are sent or retrieved from. Outgoing mail uses SMTP servers (like ",[78,97,98],{},"smtp.example.com","), while incoming mail uses IMAP or POP3 servers (like ",[78,101,102],{},"imap.example.com"," or ",[78,105,106],{},"pop.example.com",").",[18,109,110],{},[36,111,112],{},"Email Protocols:",[30,114,115,121,127],{},[33,116,117,120],{},[36,118,119],{},"SMTP"," (Simple Mail Transfer Protocol) - Handles sending outgoing messages from your application to the recipient's mail server",[33,122,123,126],{},[36,124,125],{},"POP3"," (Post Office Protocol v3) - Downloads messages to your client and typically removes them from the server",[33,128,129,132],{},[36,130,131],{},"IMAP"," (Internet Message Access Protocol) - Manages email directly on the server, keeping messages synchronized across all your devices",[89,134,136],{"id":135},"port","Port",[18,138,139],{},"Different ports serve different purposes for email communication:",[18,141,142],{},[36,143,144],{},"Outgoing (SMTP):",[30,146,147,153,159],{},[33,148,149,152],{},[36,150,151],{},"465"," - Uses SSL encryption from the start of the connection",[33,154,155,158],{},[36,156,157],{},"587"," - Uses TLS encryption with STARTTLS (recommended)",[33,160,161,164],{},[36,162,163],{},"25"," - The original SMTP port, though many ISPs block it for security reasons",[18,166,167],{},[36,168,169],{},"Incoming:",[30,171,172,178,184,190],{},[33,173,174,177],{},[36,175,176],{},"993"," - IMAP with SSL encryption",[33,179,180,183],{},[36,181,182],{},"143"," - IMAP without encryption",[33,185,186,189],{},[36,187,188],{},"995"," - POP3 with SSL encryption",[33,191,192,195],{},[36,193,194],{},"110"," - POP3 without encryption",[89,197,199],{"id":198},"use-secure-connection","Use Secure Connection",[18,201,202],{},"Enable this option to encrypt your connection using TLS, which protects your email credentials and content during transmission.",[18,204,205,208],{},[36,206,207],{},"Note:"," If you're using port 587 or 25 with a server that supports STARTTLS, you should leave this option disabled since the connection will upgrade to encrypted automatically.",[89,210,212],{"id":211},"auth-type","Auth Type",[18,214,215],{},"Choose the authentication method your email provider requires:",[30,217,218,224,230],{},[33,219,220,223],{},[36,221,222],{},"Basic"," - Standard username and password authentication",[33,225,226,229],{},[36,227,228],{},"XOAuth"," - OAuth authentication using a username and access token",[33,231,232,235],{},[36,233,234],{},"None"," - No authentication required (rare and not recommended for outgoing mail)",[89,237,239],{"id":238},"tls-option","TLS Option",[18,241,242],{},"When enabled, this option verifies that your mail server's SSL\u002FTLS certificate is valid, adding an extra layer of security to your connection.",[89,244,246],{"id":245},"format-to-sasl","Format to SASL",[18,248,249],{},"This option handles SASL (Simple Authentication and Security Layer) XOAuth2 token formatting:",[30,251,252,258],{},[33,253,254,257],{},[36,255,256],{},"Enabled"," - The node automatically formats your OAuth2 token by combining the username and token, encoding it in base64",[33,259,260,263],{},[36,261,262],{},"Disabled"," - You'll need to manually format the token before passing it to the email node",[22,265,267],{"id":266},"gmail-configuration","Gmail Configuration",[18,269,270],{},"This guide uses Gmail as the email provider. Here's what you need to configure:",[30,272,273,282,290,302,308],{},[33,274,275,278,279],{},[36,276,277],{},"Server (outgoing):"," ",[78,280,281],{},"smtp.gmail.com",[33,283,284,278,287],{},[36,285,286],{},"Server (incoming):",[78,288,289],{},"imap.gmail.com",[33,291,292,295,296,301],{},[36,293,294],{},"User ID:"," Your Gmail address (",[297,298,300],"a",{"href":299},"mailto:example@gmail.com","example@gmail.com",")",[33,303,304,307],{},[36,305,306],{},"Port:"," 465 (SSL) or 587 (TLS)",[33,309,310,313,314,320],{},[36,311,312],{},"Password:"," You'll need to generate an app password for your Google account. Visit ",[297,315,319],{"href":316,"rel":317},"https:\u002F\u002Fsupport.google.com\u002Fmail\u002Fanswer\u002F185833?hl=en",[318],"nofollow","Sign in with app passwords"," to create one. Generate a separate app password for each Node-RED application you create.",[22,322,324],{"id":323},"setting-up-environment-variables","Setting Up Environment Variables",[18,326,327,328,332],{},"Storing your email credentials directly in Node-RED flows exposes sensitive information. Environment variables keep your credentials secure by storing them separately from your flow configuration. For a detailed explanation, see ",[297,329,331],{"href":330},"\u002Fblog\u002F2023\u002F01\u002Fenvironment-variables-in-node-red\u002F","Using Environment Variables with Node-RED",".",[18,334,335],{},[336,337],"img",{"alt":338,"src":339,"title":340,"dataZoomable":12},"\"Screenshot of FlowFuse instance settings Environment tab\"","\u002Fnode-red-media\u002Fnotification\u002Fimages\u002Fsending-and-receiving-email-with-node-red-node-red_setting_environment_variables.png","Screenshot of FlowFuse instance settings Environment tab",[63,342,343,346,356,359],{},[33,344,345],{},"Navigate to your instance Settings and select the Environment tab",[33,347,348,349,352,353],{},"Click \"Add variable\" and create variables for both ",[78,350,351],{},"userid"," and ",[78,354,355],{},"password",[33,357,358],{},"Click \"Save\" to store your variables",[33,360,361],{},"Restart your instance using the Actions menu (top-right) and selecting Restart",[22,363,365],{"id":364},"configuring-the-email-output-node","Configuring the Email Output Node",[63,367,368,375,395,401,404,407,410],{},[33,369,370,371,374],{},"Drag an ",[36,372,373],{},"e-mail"," node onto the canvas and double-click to open it",[33,376,377,378,381,382,352,385,388,389,394],{},"Enter the recipient's email address in the \"to\" field. You can also set this dynamically using ",[78,379,380],{},"msg.to",", and include CC or BCC recipients with ",[78,383,384],{},"msg.cc",[78,386,387],{},"msg.bcc",". See the ",[297,390,393],{"href":391,"rel":392},"https:\u002F\u002Fflows.nodered.org\u002Fnode\u002Fnode-red-node-email",[318],"Node README"," for more details.",[33,396,397,398,400],{},"Enter ",[78,399,281],{}," as your server address",[33,402,403],{},"Choose port 465 for SSL or 587 for TLS (either works)",[33,405,406],{},"Set auth type to \"Basic\"",[33,408,409],{},"Enter your environment variables for user ID and password in the corresponding fields",[33,411,412],{},"Enable the \"Use secure connection\" option",[18,414,415,420],{},[336,416],{"alt":417,"src":418,"title":419},"\"Screenshot displaying configuration of e-mail node for sending emails\"","\u002Fnode-red-media\u002Fnotification\u002Fimages\u002Fsending-and-receiving-email-with-node-red-e-mail-in-node-configuration.png","Screenshot displaying configuration of e-mail node for sending emails"," {data-zoomable}",[22,422,424],{"id":423},"sending-emails","Sending Emails",[63,426,427,433,458,464],{},[33,428,370,429,432],{},[36,430,431],{},"inject"," node onto the canvas",[33,434,435,436,439,440,443,444,447,448,451,452,457],{},"Set ",[78,437,438],{},"msg.payload"," to your email body content. For more control, use ",[78,441,442],{},"msg.plaintext"," for plain text emails, ",[78,445,446],{},"msg.html"," for HTML-formatted emails, or ",[78,449,450],{},"msg.attachment"," (as an array) for attachments in ",[297,453,456],{"href":454,"rel":455},"https:\u002F\u002Fnodemailer.com\u002Fmessage\u002Fattachments\u002F",[318],"Nodemailer"," format.",[33,459,435,460,463],{},[78,461,462],{},"msg.topic"," to your email subject line",[33,465,466],{},"Connect the inject node's output to the e-mail node's input",[18,468,469,420],{},[336,470],{"alt":471,"src":472,"title":473},"\"Screenshot of the inject node setting payload for sending email notification\"","\u002Fnode-red-media\u002Fnotification\u002Fimages\u002Fsending-and-receiving-email-with-node-red-inject-node.png","Screenshot of the inject node setting payload for sending email notification",[22,475,477],{"id":476},"receiving-emails","Receiving Emails",[63,479,480,485,488,491,494,501],{},[33,481,370,482,432],{},[36,483,484],{},"e-mail in",[33,486,487],{},"Select your preferred \"Get mail\" option",[33,489,490],{},"Set the Protocol to \"IMAP\" (recommended for third-party applications)",[33,492,493],{},"Enter your environment variables for userid and password",[33,495,496,497,500],{},"Add a ",[36,498,499],{},"debug"," node to the canvas",[33,502,503],{},"Connect the debug node's input to the e-mail in node's output",[18,505,506],{},[336,507],{"alt":508,"src":509,"title":510,"dataZoomable":12},"\"Screenshot displaying configuration of e-mail in node for sending emails\"","\u002Fnode-red-media\u002Fnotification\u002Fimages\u002Fsending-and-receiving-email-with-node-red-e-mail-node-configuration.png","Screenshot displaying configuration of e-mail in node for sending emails",[22,512,514],{"id":513},"deploying-the-flow","Deploying the Flow",[18,516,517],{},[336,518],{"alt":519,"src":520,"title":521,"dataZoomable":12},"\"Screenshot displaying Node-RED flow: Sending and Receiving Emails using Node-RED\"","\u002Fnode-red-media\u002Fnotification\u002Fimages\u002Fsending-and-receiving-email-with-node-red-node-red-flow.png","Screenshot displaying Node-RED flow: Sending and Receiving Emails using Node-RED",[18,523,524],{},[336,525],{"alt":526,"src":527,"title":528,"dataZoomable":12},"\"Screenshot of Gmail inbox displaying received email notification\"","\u002Fnode-red-media\u002Fnotification\u002Fimages\u002Fsending-and-receiving-email-with-node-red-gmail-inbox.png","Screenshot of Gmail inbox displaying received email notification",[18,530,531],{},"Click the \"Deploy\" button in the top-right of the Node-RED Editor. Once deployed, you can send emails by clicking the inject button, or configure triggers to send notifications based on specific events in your IoT application.",[22,533,535],{"id":534},"ensuring-your-emails-reach-their-destination","Ensuring Your Emails Reach Their Destination",[89,537,539],{"id":538},"understanding-anti-spam-measures","Understanding Anti-Spam Measures",[18,541,542],{},"Email servers use sophisticated filtering systems to protect users from unwanted messages. These systems analyze various aspects of incoming emails:",[18,544,545,548,549,552,553,556,557,560],{},[36,546,547],{},"Content filtering"," scans your email text for keywords and patterns commonly found in spam. ",[36,550,551],{},"Sender authentication"," verifies that your email address and domain are legitimate, often using protocols like SPF to confirm your server is authorized to send emails on behalf of your domain. ",[36,554,555],{},"IP filtering"," blocks messages from IP addresses with known spam activity. ",[36,558,559],{},"Reputation scoring"," tracks your sending history and behavior, assigning a score that affects whether your emails land in inboxes or spam folders.",[89,562,564],{"id":563},"best-practices-for-email-delivery","Best Practices for Email Delivery",[18,566,567],{},"Even legitimate emails can sometimes trigger spam filters. Follow these practices to keep your notifications flowing smoothly:",[30,569,570,576,582,588,594,600],{},[33,571,572,575],{},[36,573,574],{},"Write clear, purposeful messages"," - Keep your content focused and action-oriented, clearly stating why you're sending the notification and what action recipients should take.",[33,577,578,581],{},[36,579,580],{},"Avoid spam trigger words"," - Stay away from phrases like \"free,\" \"limited time offer,\" or \"urgent\" that commonly appear in spam messages.",[33,583,584,587],{},[36,585,586],{},"Authenticate your emails"," - Implement SPF, DKIM, and DMARC protocols to verify your email's legitimacy and improve deliverability.",[33,589,590,593],{},[36,591,592],{},"Manage your sending frequency"," - Avoid sending too many emails in a short period. Maintain a consistent schedule and ensure each message provides value.",[33,595,596,599],{},[36,597,598],{},"Keep your email list clean"," - Regularly remove invalid or inactive addresses. High bounce rates and spam complaints damage your sender reputation.",[33,601,602,605],{},[36,603,604],{},"Monitor your reputation"," - Use tools like SenderScore or Google Postmaster Tools to track your sender reputation and identify potential issues before they affect delivery.",{"title":12,"searchDepth":607,"depth":607,"links":608},2,[609,610,611,620,621,622,623,624,625,626],{"id":24,"depth":607,"text":25},{"id":60,"depth":607,"text":61},{"id":86,"depth":607,"text":87,"children":612},[613,615,616,617,618,619],{"id":91,"depth":614,"text":92},3,{"id":135,"depth":614,"text":136},{"id":198,"depth":614,"text":199},{"id":211,"depth":614,"text":212},{"id":238,"depth":614,"text":239},{"id":245,"depth":614,"text":246},{"id":266,"depth":607,"text":267},{"id":323,"depth":607,"text":324},{"id":364,"depth":607,"text":365},{"id":423,"depth":607,"text":424},{"id":476,"depth":607,"text":477},{"id":513,"depth":607,"text":514},{"id":534,"depth":607,"text":535,"children":627},[628,629],{"id":538,"depth":614,"text":539},{"id":563,"depth":614,"text":564},"Learn how to send and receive emails using Node-RED, along with best practices for sending email notifications.","md",{},true,"\u002Fnode-red\u002Fnotification\u002Femail",{"title":5,"description":630},"node-red\u002Fnotification\u002Femail","rGYF5nqufps-KFj0PSPpA2aVU6yrP1JBGU_SzENoeKs",1780070557775]