mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
Updated Email (markdown)
parent
141de561dd
commit
92214b6eaf
42
Email.md
42
Email.md
@ -42,6 +42,48 @@ __Answer__: NK 2016-03-06 - I vote for the direct output of a record from the `
|
||||
|
||||
---
|
||||
|
||||
### Proposed design
|
||||
|
||||
Here we discuss the best so far notion for the design for processing incoming emails. The design is in the form of synchronous pseudo code which, when implemented in JavaScript, will become event based.
|
||||
|
||||
```
|
||||
// Called periodically to check email. Farms out the request to the correct email input technology
|
||||
function checkEmail() {
|
||||
if (useIMAP) {
|
||||
checkIMAP();
|
||||
} else if (usePOP3) {
|
||||
checkPOP3();
|
||||
}
|
||||
}
|
||||
|
||||
function checkIMAP() {
|
||||
connect to email server using IMAP;
|
||||
if (there are new messages) {
|
||||
for (each new message) {
|
||||
retrieve the new message;
|
||||
processNewMessage(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function checkPOP3() {
|
||||
connect to email server using POP3;
|
||||
if (there are new messages) {
|
||||
for (each new message) {
|
||||
retrieve the new message;
|
||||
processNewMessage(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function processNewMessage(message) {
|
||||
parse the email message into its parts;
|
||||
build an outgoing Node-RED object from the email message;
|
||||
send the message onwards for processing down the flow;
|
||||
}
|
||||
```
|
||||
---
|
||||
|
||||
### Related forum posts and issues:
|
||||
|
||||
* Forum: [Retrieving email attachments using the email input node](https://groups.google.com/d/msg/node-red/UMIJyGVab-A/mLG7quyKBAAJ)
|
||||
|
Loading…
Reference in New Issue
Block a user