'Save Mail Message' not creating folders

Hi all!

I’m going through the module about email automation and am trying to get emails from an inbox and save them to my drive in sorted folders. I’m using the ‘Save Mail Message’ activity, but it doesn’t work like I would expect.

When I read the documentation for ‘Save Mail Message’ it says that folders will be created if they don’t exist. In my case, it writes 'Could not find part of the path ‘C:\users[…]\Destination folder\Sorted Folder Name\Name of the File’.

  • And I’m thinking - “Yeah, that’s kinda what you’re supposed to create…”

My path looks like this:
“Sorted emails/” + mail.Sender + “/” + mail.subject

Can anyone tell my why it doesn’t just create the missing folders?


Hi Henrik, welcome!

I can confirm, the activity didn’t create the specified folder for me either and instead gives a DirectoryNotFoundException.

Maybe @loginerror can take a look?

Workaround: Check the folder with a Path Exists activity, evaluate the output boolean with an If activity and use the Create Folder activity to create the folder dynamically yourself.


1 Like

Hi @lukasziebold,

Thank you for taking a look at it. It’s good to know it’s not just me being dumb. I had thought of doing the workaround but thought it shouldn’t be necessary. I’ll try it out!

1 Like

Hi @henrik.norgaard

I’ll save this as an improvement, it would seem like it should create a folder on its own.

On the other hand, the current implementation allows you for more granular control over your process, in a way.

Either that, or an easy solution could be to change the documentation :wink:

1 Like

Our Mail activity package will investigate and adjust either the activity or the documentation :slight_smile:

1 Like

Once again thank you for reporting the potential bug. Our team had a look and the upcoming version of the Mail activity package will address this issue and the activity will create the folders for you.

The version of the package that will include the fix will be UiPath.Mail.Activities 1.11.1 or greater.

1 Like