This area of the website is no longer being updated.
Changes and news are now published on this page.

How to save email attachments and body text to a different folder for each email

September 2, 2018

Email Parser is commonly used to capture text from incoming emails and update databases, spreadsheets etc. but another very common use case is to use it as an email archiving tool. We have recently received the following question regarding the latter:

I’m considering using Email Parser to catch mails from an Office 365 account, and save all the attachments to a folder.
I don’t want the attachments to be saved in one big folder. Instead, I need one sub-folder to be created per email received. Name of the subfolder can be a timestamp or ID. Or name of subject but there is a risk of same names.
I also want the body of each mail to be saved in the corresponding sub-folder as an html file or even better as a .pdf file.

A configuration that does so looks as following:

We used the Save Attachments action to tell Email Parser to save all the attachments to a folder, but in order to save the attachments to a specific folder, different for every email, we will need to create a field to use it as folder name. Like this:

We can use the MessageID (available in the email headers), the date of the email or the subject to create a folder name. There are many approaches here and, in this example, we have chosen to use a combination of the Subject, the date and the time when the email was sent. Something like:

2018-08-10 15-13-39-this is the subject

In order to do so, we have to understand that are some characters that are now allowed to be part of a folder name. These characters are \/:*?<> . Before using the Subject or the date/time of sending we must remove that characters from them. Like this:

Then we combine the fields in the save attachments action like this:

Finally, in order to get the text body saved as an html file (sorry, no PDF file) we use the save to text file action like this:


© 2008-2024 Triple Click Software
News & Updates

Privacy Policy & Terms of Use
PAD file·Old news