Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Move IMAP message using EmailMoveCurrentMessage

Featured Replies

  • Newbies

Hello there, we are attempting to use 360Works Email plugin to move an IMAP message to a different folder, specifically one that has been downloaded previously. The EmailMoveCurrentMessage command seems to be set up to work on the message currently being sent  or on the last message rec'd. I am struggling to figure out how to move a message to another folder if that message was downloaded a few days ago, for instance.

Here's my current script. Any ideas? Thank you in advance! I am beginning to wrap my head around other parts of this plugin, but this in particular has kept me thinking for days and I'm not sure I feel any closer now than I did when I started!

#this establishes the connection to the IMAP server using 360Works script provided in example file
Perform Script [ Connect Inbound ]

#this script is run from the perspective of a single message
Set Variable [ $messageIDtoMove ; Value:EmailReadMessageValue (Message::messageId) ] 

#readonly=false is there to ensure a message is moved, not copied
Set Variable [ $getMessage; Value:EmailReadMessages("readonly=false";"messageID=" & $messageIDtoMove) ]

#I'm thinking the error may be in this step, it doesn't make sense to me given the documentation...
Set Variable [ $result; Value:EmailGetNextMessage ] 

#moves message to "Processed" folder, which is already on the IMAP server
Set Variable [ $moveResult ; Value:EmailMoveCurrentMessage ("Processed") ] 

Thank you,

Stephen

 

PS - I am using Filemaker Pro Advanced 12 on Windows with Email plugin v. 2.17

Edited by 7345565
Added details

Hi Stephen, 

Unless you are storing the text "messageID" in the Message::MessageID field then the second step is unnecessary and is probably resulting in an error which in turn will throw off the entire script.I definitely recommend putting in some error capturing into your script so you can tell where it is failing.  Assuming that you are storing a messageID in the Message::MessageID field when you read the message originally, your second step after connecting should be a EmailReadMessages("readonly=false";"messageID="& Message::MessageID). This will in turn only fetch that particular message and load it into memory. Next, call EmailGetNextMessage. This will iterate to the first message fetched(and the only message in this case). Now you can call EmailMoveCurrentMessage("Processed") . 

Of note, I have seen this process fail on certain mail servers, namely GoDaddy, due to a difference in the messageIDs that are returned when calling EmailGetMessageValue("messageID") and the way the mail server parses it when calling EmailReadMessages(MessageID) is called. If you run into issues where you are getting "no messages" when calling the read function but the message is definitely on the mail server then I recommend trying this process with UIDs or another unique value of the email such as the body.

  • Author
  • Newbies

Ryan,

Thank you so much for your help! I find the 360Works Email plugin much easier to understand than the Dacons plugin, but this is still complicated stuff to me. I appreciate your quick reply and also the helpful tips. I will give this a go!

 

Thank you,

Stephen

Stephen, 

Glad I could help! I try to check the forums every day but if you run into any errors or issues you can email [email protected] . That will automatically assign you a support ticket in our system and we can typically get back to you within the same day if not sooner. Good luck with your development!

 

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.