Jump to content
martincl

download attachments with map

Recommended Posts

martincl    0

Hello,

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

Thanks

Marty

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

Share this post


Link to post
Share on other sites
ryan360Works    16

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
bradQual    0

Ryan:

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
ryan360Works    16

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
bradQual    0

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


  • Similar Content

    • By samarthmkt
      How we can send email with attachment while sending through 360 email plugin . Need any script for this. Thanks
    • By Fred Rogers
      Where to start.

      We are now getting important client information e-mailed to us in the form of attachments.
      The attachments have the clients name and a reference number in the file name. ie Smith, John, 1234567.pdf

      What I would like is to forward the email message based on the attachment name, inducing the orignal attachment.

      Or what would be even better if I could download the attachments, put them in a clients folder then e-mail the staff member alerting them that a clients files have been updated.

      Right now I have a server script that runs every 15 minutes to get the mail.
      I can see the attachment names, but I am unsure how to work with the files.

      Thanks!

      -=fred=-
    • By andru
      I'm working with a Go database and trying to email a pdf copy of a FM layout.

      I'm able to save the FM layout as a pdf without any problem and I'm able to then email a message from Go to an external email but I'm not able to get the saved pdf to attach to the email.

      I can see the saved pdf file in my files on the iPad and I can open it on my desktop, so I know that part worked.

      I'm suspecting that I haven't set the file path correctly in the attachment options. Any advice appreciated.
    • By rickyd
      Hi all,

      We just bought the 360works E-mail plugin, and we're having some trouble getting attachments to work properly. The script which is sending e-mails is supposed to pull attachments from a container field (Emails::attach1). And it does...sort of.

      The e-mail sends successfully, and contains an attachment. Except that the attachment is a .jpeg of what the container field LOOKS like, not a copy of the file it contains. I've tried this with .txt files, .zip files, .doc files, etc. Every time, I just get a picture of what the container field looks like.

      When sending documents, I get an image of the first page of the document.

      Any ideas what I'm doing wrong? Below is the line in the script that is doing the attachment. Platform is Windows 7 x64, Filemaker 10.3 Pro, E-mail plugin v. 1.96.

      Set Variable $emailattach = EmailAttachFile( Emails::attach1 )

      Any ideas?

      Thanks in advance.

      -RD
×

Important Information

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