Jump to content

Move IMAP message using EmailMoveCurrentMessage


7345565
 Share

This topic is 2284 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • 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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 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

Link to comment
Share on other sites

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!

 

Link to comment
Share on other sites

This topic is 2284 days old. Please don't post here. Open a new topic instead.

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
 Share

×
×
  • Create New...

Important Information

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