2015-06-13 19:46:07 +02:00
|
|
|
node-red-node-email
|
|
|
|
===================
|
|
|
|
|
2018-09-04 19:51:20 +02:00
|
|
|
<a href="http://nodered.org" target="info">Node-RED</a> nodes to send and receive simple emails.
|
2015-06-13 19:46:07 +02:00
|
|
|
|
|
|
|
|
|
|
|
Pre-requisite
|
|
|
|
-------------
|
|
|
|
|
2015-06-16 10:17:06 +02:00
|
|
|
You will need valid email credentials for your email server.
|
2015-06-13 19:46:07 +02:00
|
|
|
|
2018-09-04 19:51:20 +02:00
|
|
|
**Note :** Version 1.x of this node requires **Node.js v8** or newer.
|
2018-05-01 23:06:54 +02:00
|
|
|
|
|
|
|
|
2015-06-13 19:46:07 +02:00
|
|
|
Install
|
|
|
|
-------
|
|
|
|
|
2018-05-01 23:06:54 +02:00
|
|
|
Version 0.x of this node is usually installed by default by Node-RED.
|
|
|
|
To install version 1.x you need to uninstall the existing version.
|
|
|
|
|
2018-09-03 21:06:36 +02:00
|
|
|
cd /usr/lib/node_modules/node-red
|
|
|
|
sudo npm uninstall --unsafe-perm node-red-node-email
|
2018-05-01 22:31:22 +02:00
|
|
|
|
2018-05-01 23:06:54 +02:00
|
|
|
Then run the following command in your Node-RED user directory - typically `~/.node-red`
|
2015-06-13 19:46:07 +02:00
|
|
|
|
2018-09-03 21:06:36 +02:00
|
|
|
cd ~/.node-red
|
2016-03-02 14:18:24 +01:00
|
|
|
npm i node-red-node-email
|
2015-06-13 19:46:07 +02:00
|
|
|
|
2018-05-01 23:06:54 +02:00
|
|
|
**Note :** this installs the new version locally rather than globally. This can then be managed by the palette manager.
|
|
|
|
|
|
|
|
|
2015-06-13 19:46:07 +02:00
|
|
|
Usage
|
|
|
|
-----
|
|
|
|
|
|
|
|
Nodes to send and receive simple emails.
|
|
|
|
|
2016-03-02 14:18:24 +01:00
|
|
|
### Input
|
2015-06-13 19:46:07 +02:00
|
|
|
|
2016-04-20 20:47:23 +02:00
|
|
|
Repeatedly gets emails from an IMAP or POP3 server and forwards them onwards as messages if not already seen.
|
2015-06-13 19:46:07 +02:00
|
|
|
|
2016-03-02 14:18:24 +01:00
|
|
|
The subject is loaded into `msg.topic` and `msg.payload` is the plain text body.
|
|
|
|
If there is text/html then that is returned in `msg.html`. `msg.from` and
|
|
|
|
`msg.date` are also set if you need them.
|
2015-06-13 19:46:07 +02:00
|
|
|
|
2016-03-02 14:18:24 +01:00
|
|
|
Additionally `msg.header` contains the complete header object including
|
2015-06-13 19:46:07 +02:00
|
|
|
**to**, **cc** and other potentially useful properties.
|
|
|
|
|
|
|
|
**Note:** this node *only* gets the most recent single email from the inbox,
|
|
|
|
so set the repeat (polling) time appropriately.
|
|
|
|
|
|
|
|
Uses the *imap* npm module.
|
|
|
|
|
2016-03-02 14:18:24 +01:00
|
|
|
### Output
|
2015-06-13 19:46:07 +02:00
|
|
|
|
2016-08-03 10:01:28 +02:00
|
|
|
Sends the `msg.payload` as an email, with a subject of `msg.topic`.
|
2015-06-13 19:46:07 +02:00
|
|
|
|
|
|
|
The default message recipient can be configured in the node, if it is left
|
2016-03-02 14:18:24 +01:00
|
|
|
blank it should be set using the `msg.to` property of the incoming message.
|
2015-06-13 19:46:07 +02:00
|
|
|
|
2016-08-03 10:01:28 +02:00
|
|
|
You may optionally override the *from* email address by setting `msg.from`,
|
|
|
|
otherwise the node will use the `userid` setting from the server connection.
|
|
|
|
|
2015-06-13 19:46:07 +02:00
|
|
|
The payload can be html format.
|
|
|
|
|
|
|
|
If the payload is a binary buffer then it will be converted to an attachment.
|
|
|
|
|
2016-03-02 14:18:24 +01:00
|
|
|
The filename should be set using `msg.filename`. Optionally
|
|
|
|
`msg.description` can be added for the body text.
|
2015-06-13 19:46:07 +02:00
|
|
|
|
2016-03-02 14:18:24 +01:00
|
|
|
Alternatively you may provide `msg.attachments` which should contain an array of one or
|
2015-06-13 19:46:07 +02:00
|
|
|
more attachments in <a href="https://www.npmjs.com/package/nodemailer#attachments" target="_new">nodemailer</a> format.
|
|
|
|
|
|
|
|
Uses the *nodemailer* npm module.
|