Sometimes I get stuff on email that need to be kept for a future revision of some kind.
If the mail itself is the only “document” it may not be so easy to find when the revisor ask for it.
So I came up with this idea:
The flow checks for unread mails in my Inbox\FarmOS folder. If so, it creates a log with the mail topic as the log’s name, and the mail body as the log’s note.
I also put an “Email” category to it, so it’s easy to verify them later.
I set up a mail alias and when I forward a mail to the alias, the mail is placed in the FarmOS folder.
When the flow is executed, the email node changes the mail read status.
Not too half-bad if I may say so…
Edit: Added the mail timestamp as timestamp for the log for better filtering.
[
{
"id": "9d8a923241677a34",
"type": "e-mail in",
"z": "1ca30f9571004237",
"name": "",
"protocol": "IMAP",
"server": "imap.fastmail.com",
"useSSL": true,
"autotls": "never",
"port": "993",
"box": "FarmOS",
"disposition": "Read",
"criteria": "UNSEEN",
"repeat": "3600",
"fetch": "auto",
"inputs": 0,
"x": 190,
"y": 1080,
"wires": [
[
"e0938f721fea4f15"
]
]
},
{
"id": "e0938f721fea4f15",
"type": "function",
"z": "1ca30f9571004237",
"name": "function 28",
"func": "\nvar maildate = Math.floor(new Date(msg.date).getTime() / 1000);\nvar mail=\n{\n \"data\": {\n \"type\": 'log--observation',\n \"attributes\": {\n \"name\": \"Epost - \" + msg.topic,\n \"status\": \"done\",\n \"notes\": \"\" + msg.payload,\n \"timestamp\": + maildate\n },\n \"relationships\": {\n \"category\": {\n \"data\": [\n {\n \"type\": \"taxonomy_term--log_category\",\n \"id\": \"dbb44cda-addb-4c5e-b41d-237691a3a71e\" //Epost-katoegori\n }\n ]\n }\n }\n }\n}\nmsg.payload = mail;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 330,
"y": 1080,
"wires": [
[
"2894caf76e2466f5"
]
]
},
{
"id": "2894caf76e2466f5",
"type": "sf:949541c9b70110d5",
"z": "1ca30f9571004237",
"name": "",
"API": "log/observation",
"Method": "POST",
"x": 510,
"y": 1080,
"wires": [
[
"f8f6784bbb8f464c"
]
]
},
{
"id": "f8f6784bbb8f464c",
"type": "debug",
"z": "1ca30f9571004237",
"name": "debug 96",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 660,
"y": 1080,
"wires": []
}
]