Managing email attachments can be a time-consuming task, especially if you receive many emails with important files.
This n8n workflow automates downloading attachments from Microsoft Outlook and saving them to specific folders based on the sender's email. It also uploads these attachments to Nextcloud. Here's how it works and how you can adapt it to your needs.
Workflow Overview
- Microsoft Outlook Trigger: Monitors your Outlook inbox for emails with attachments.
- Split Out Attachments: Separates the attachments from each email.
- Map Sender Email to Target Folder: Determines the target folder based on the sender's email.
- Write Attachment to Disk: Saves the attachment to a local folder.
- Upload to Nextcloud: Uploads the attachment to Nextcloud.
Adapting the Workflow to Your Needs
Modify Email Polling Frequency:
- Adjust the
pollTimes
parameter in the Microsoft Outlook Trigger node to change how often your inbox is checked.
- Adjust the
Customize Folder Mapping:
- Update the
folderMapping
object in the JavaScript code of the Map Sender Email to Target Folder node to add more mappings or change existing ones.
- Update the
Change Local Save Path:
- Modify the
fileName
parameter in the Write Attachment to Disk node to save attachments to a different local directory.
- Modify the
Update Nextcloud Upload Path:
- Change the
path
parameter in the Upload to Nextcloud node to upload attachments to different folders in your Nextcloud account.
- Change the
By following this guide, you can streamline the process of handling email attachments, saving time and reducing manual effort.
Adjust the workflow as needed to fit your specific use case, ensuring a more efficient email management system.
Alternative sorting rules
If you need to sort the attachments based on keywords in the subject or even using AI, here's a workflow template to pick and choose from: