⚡ Only 300 spots remaining • Closes in 2d 14h 32m
This comprehensive workflow automation helps you streamline Emailreadimap Nextcloud Send processes. By using this blueprint, you can eliminate manual data entry and ensure seamless integration between your favorite platforms.
This workflow is pre-configured and ready for deployment. Simply import the JSON template into your n8n instance and configure your credentials.
This is an exclusive blueprint. Copy the JSON below to use it.
PRO TIP
Always test your workflow in a development environment before pushing to production.
{
"nodes": [
{
"name": "IMAP Email",
"type": "n8n-nodes-base.emailReadImap",
"position": [
240,
420
],
"parameters": {
"format": "resolved",
"mailbox": "Invoices",
"options": {
"customEmailConfig": "[\"ALL\"]"
}
},
"typeVersion": 1
},
{
"name": "Nextcloud",
"type": "n8n-nodes-base.nextCloud",
"position": [
940,
420
],
"parameters": {
"path": "=Documents/Invoices/{{$json[\"date\"]}}_{{$json[\"from\"]}}_{{$binary.file.fileName}}",
"binaryDataUpload": true,
"binaryPropertyName": "file"
},
"typeVersion": 1
},
{
"name": "Map each attachment",
"type": "n8n-nodes-base.function",
"position": [
620,
420
],
"parameters": {
"functionCode": "const _ = require('lodash')\n\nconst sanitize = str => _.chain(str)\n .replace(/[^A-Za-z0-9&.-]/g, '-') // sanitise via whitelist of characters\n .replace(/-(?=-)/g, '') // remove repeated dashes - https://regexr.com/6ag8h\n .trim('-') // trim any leading/trailing dashes\n .truncate({\n length: 60,\n omission: '-' // when the string ends with '-', you'll know it was truncated\n })\n .value()\n\nconst result = _.flatMap(items.map(item => {\n //console.log({item})\n\n // Maps each attachment to a separate item\n return _.values(item.binary).map(file => {\n console.log(\"Saving attachement:\", file.fileName, 'from:', ...item.json.from.value)\n \n // sanitize filename but exclude extension\n const filename_parts = file.fileName.split('.')\n const ext = _.slice(filename_parts, filename_parts.length-1)\n const filename_main = _.join(_.dropRight(filename_parts), '.')\n file.fileName = sanitize(filename_main) + '.' + ext\n \n return {\n json: {\n from: sanitize(item.json.from.value[0].name),\n date: sanitize(new Date(item.json.date).toISOString().split(\"T\")[0]) // get date part \"2020-01-01\"\n }, \n binary: { file }\n }\n })\n}))\n\n//console.log(result)\nreturn result"
},
"typeVersion": 1
}
],
"connections": {
"IMAP Email": {
"main": [
[
{
"node": "Map each attachment",
"type": "main",
"index": 0
}
]
]
},
"Map each attachment": {
"main": [
[
{
"node": "Nextcloud",
"type": "main",
"index": 0
}
]
]
}
}
}To use this, copy the JSON above and paste it directly onto your n8n canvas.
Join the elite marketers who have offloaded their entire backend to n8n. Get direct support and custom builds in our private forum.