January 6, 20179 yr Immediately after sending a message with EmailSend and EmailMoveCurrentMessage (to my "Sent Items" folder), how can i immediately mark that sent message as being read?
January 6, 20179 yr Alan, In order to do this you will need to call EmailOutgoingMessageID after sending to get the message ID then call EmailReadMessages on your "Sent Items" folder and pass in the parameters "readonly=false" and "messageID=$messageID". This will pull in that sent message. Then call EmailGetMessage to iterate to the message. Next, call EmailMessageSetFlag("viewed";"true"). Please note that this will only work with IMAP servers as POP servers do not support message flags.
January 6, 20179 yr Author On 1/6/2017 at 7:00 AM, ryan360Works said: Alan, In order to do this you will need to call EmailOutgoingMessageID after sending to get the message ID then call EmailReadMessages on your "Sent Items" folder and pass in the parameters "readonly=false" and "messageID=$messageID". This will pull in that sent message. Then call EmailGetMessage to iterate to the message. Next, call EmailMessageSetFlag("viewed";"true"). Please note that this will only work with IMAP servers as POP servers do not support message flags. Ryan, Thank you for the reply. I have tried to set that up as you directed. Script does send email and move message to "Sent Items" folder, but does not successfully mark it as read. Here is what I have. Does this look correct? Thanks! Set Field [ PluginExample::_result; EmailCreate( PluginExample::From ; $CurrentEmailAddress ; PluginExample::Subject) and EmailSetBody( PluginExample::Body ) and EmailAttachFile( $OutputFileName ) ] Set Field [ PluginExample::_result; EmailSend ( "progress=" & PluginExample::Progress Bar ; "progresslocation=" & PluginExample::Progress Location ) and EmailMoveCurrentMessage ( "Sent Items" ) ] #get message id from what was just sent Set Variable[ $messageID; EmailOutgoingMessageId ] Set Field [ PluginExample::_result; EmailReadMessages( "readonly=false"; "messageID=$messageID"; "mailbox=SENT ITEMS" ; "max=1") ] #Iterate to message Set Field [ PluginExample::_result; EmailGetNextMessage ] #Mark as read Set Field [ PluginExample::_result; EmailMessageSetFlag( "viewed";"true" ) ] Edited January 7, 20179 yr by alanf
January 10, 20179 yr Alan, Your script looks correct. I recommend stepping through the script and making sure that you are getting "1" when EmailGetNextMessage is called. If you are not getting a "1", then the message is not getting read in. If you do get a "1", add a EmailReadMessageValue after the EmailGetNextMessage call and pass in a value that you can use to identify the message to make sure that it is the correct one. Another thing to check would be to make sure you are getting the message ID. EmailGetOutgoingMessageID returns the message ID or "" if there is no message. I also recommend adding some error checking/data validation to your script.
January 31, 20187 yr @alanf did you ever get this working? I'm trying to do the same and can't seem to figure it out.
Create an account or sign in to comment