Jump to content

download attachments with map

Recommended Posts


I see that I can download the attachment name with the IMAP connection.  Can I get the actual attachment file downloaded to a container?



Screen Shot 2017-03-18 at 9.53.59 AM.png

Share this post

Link to post
Share on other sites

Hi martincl,

You can get the actual attachments into a container field. However, the example file is not currently set up to do this. In order to do this, you need to set "attachments=true" in the EmailReadMessages function call. This will tell the email plugin to download the attachments. When iterating through the emails, you will call EmailGetMessageValue("attachments"). This returns a return-separated list of paths to the attachments. You will then need to loop through that list and call Set Field(table:myfield;EmailReadAttachment(path)) to put the attachment into a container field.

Share this post

Link to post
Share on other sites


In Line 3 of script: "EmailReadMessages" I have changed "attachments=false" to "attachments=true".
I now get a return separated list of attachments which includes the filepath.

I converted the field [Attachment] in the table ImportedMessages to a container (like the corresponding field in PlugInExample), but the filepaths and filenames still appear as text.

I then altered Line 32 to read EmailReadMessageValue("attachments=true") this time nothing downloaded to the attachments field.

Where do I insert the line: Set Field(table:myfield;EmailReadAttachment(path) to download the attachments to containers?
I am making the changes in a copy of the 360Works_email file so I am assuming "table" is ImportedMessages and "myfield" is Attachments, what do I put into "(path)? 
Should the field Attachments be a container? If it is a container should the data be stored externally and secure?
If there is more than one attachment will a separate record be created for each attachment?

Thank you

Share this post

Link to post
Share on other sites

Hi bradQual,

First, the parameter you pass into EmailReadMessageValue should be "attachments" instead of "attachments=true". EmailReadMessageValue("attachments") returns a return-separated list of paths to the attachments for a message. You will then need to loop through this list and call EmailReadAttachments(path) in a Set Field script step for each value in the list. This will put the attachment at (path) into the container field. You would either need multiple container fields or create a new record for each attachment. Storage options are entirely up to you.

A side note, I highly recommend against modifying the Example Client. It was set up specifically to not download attachments at first and then download them on demand when a message is viewed. As you have discovered, it becomes quite convoluted trying to modify it to do exactly what you need. In my experience with other customers trying to do this, you will save yourself time and heartache by using the scripts as a general guide and then creating your own data structure and writing your own scripts in your solution.


  • Like 1

Share this post

Link to post
Share on other sites

Ryan, thank you I can see how to do it now.
To cope with multiple attachments I am creating a new table for attachments, linked to the message table by the field "uid", and create a new record as I download each attachment.

You say that the Example Client is set up to allow you to download attachments when the message is viewed, but I cannot see any attachments in the "HTML" view.  Perhaps you could improve the Example Client.
(I attach a screen shot showing the message view and HTML view.)

Message HTML.jpg

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


Important Information

By using this site, you agree to our Terms of Use.