Page 1 of 1

imap mail loop

Posted: Wed Jan 28, 2015 5:49 pm
by rgonzalez
Hello, how can I delete a message at the end of each imap mail loop without breaking the order for the next iteration?

Let's say I have 5 messages, and the imap mail loop takes a var for the message order. After I process each message, I need to delete that message, but in the next iteration the message number changes, so the imap mail loop throws an error.

Also I tried to always parse and delete the message no. 1, but it's not working either.

I don't have any problems if I delete all the messages after the loop is ended, but it's crucial for me to delete each message after being processed individually.

Also imap move message is working as copy message. The window title for that action differs on the name.

Example:

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1881165001
Comment=STRINGLIST
ContinueOnError=INTEGER|0
Events=FOLDER
ExternalName=STRING|"Task70"
Hide=INTEGER|0
ID=INTEGER|489364280
LogOnAsUser=INTEGER|1
Name=STRING|"imap mail loop test"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|1
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER
Action9=FOLDER

[Actions\Action1]
ActionID=STRING|"A_IMAP_OPEN"
Enabled=INTEGER|-1
Name=STRING|"IMAP Open"
Params=FOLDER

[Actions\Action1\Params]
folder=STRING|"INBOX"
host=STRING|"test@test.com"
password=STRING|"4540845249455204524945520"
passwordmode=STRING|"0"
port=STRING|"993"
SSL=STRING|"1"
user=STRING|"test@test.com"

[Actions\Action2]
ActionID=STRING|"A_IMAP_LOOP"
Enabled=INTEGER|-1
Name=STRING|"IMAP Mail loop"
Params=FOLDER

[Actions\Action2\Params]
flags=STRING|"D"
from=STRING|"from"
number=STRING|"msg_num"
subj=STRING|"subj"
usecc=STRING|"0"
usedate=STRING|"0"
useflags=STRING|"0"
usefrom=STRING|"1"
usesize=STRING|"0"
usesubj=STRING|"1"
useto=STRING|"0"

[Actions\Action3]
ActionID=STRING|"A_MISC_COMMENT"
Enabled=INTEGER|-1
Name=STRING|"//Do stuff like download and parse locally and then move (copy?) and delete the message"
Params=FOLDER

[Actions\Action3\Params]
comment=STRING|"Do stuff like download and parse locally and then move (copy?) and delete the message"

[Actions\Action4]
ActionID=STRING|"A_IMAP_MOVE"
Enabled=INTEGER|-1
Name=STRING|"IMAP Move Message to Folder ""INBOX.Requests"""
Params=FOLDER

[Actions\Action4\Params]
folder=STRING|"INBOX.Requests"
msgnum=STRING|"{msg_num}"
parameters=STRING|"test.com,993,1,test@test.com"

[Actions\Action5]
ActionID=STRING|"A_IMAP_SETFLAGS"
Enabled=INTEGER|-1
Name=STRING|"IMAP Set Message Flags"
Params=FOLDER

[Actions\Action5\Params]
answered=STRING|"2"
deleted=STRING|"1"
draft=STRING|"2"
flagged=STRING|"2"
msgnum=STRING|"{msg_num}"
recent=STRING|"2"
seen=STRING|"2"

[Actions\Action6]
ActionID=STRING|"A_IMAP_PURGE"
Enabled=INTEGER|-1
Name=STRING|"IMAP Delete Marked Messages"

[Actions\Action7]
ActionID=STRING|"A_IMAP_SELETFOLDER"
Enabled=INTEGER|-1
Name=STRING|"IMAP Select Folder: INBOX"
Params=FOLDER

[Actions\Action7\Params]
folder=STRING|"INBOX"

[Actions\Action8]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"

[Actions\Action9]
ActionID=STRING|"A_IMAP_CLOSE"
Enabled=INTEGER|-1
Name=STRING|"IMAP Close"

[Events]
Event1=FOLDER

[Events\Event1]
Enabled=INTEGER|0
EventID=STRING|"E_GENERAL_CYCLIC"
Params=FOLDER
UnigueID=INTEGER|1839787036

[Events\Event1\Params]
id=STRING|"RXWMU1J4"
interval=STRING|"600"
notsatrtatactivation=STRING|"0"


Re: imap mail loop

Posted: Wed Jan 28, 2015 6:26 pm
by Oleg
Move the step "IMAP Delete Marked Messages" out of the loop and remove the step "IMAP Select Folder: INBOX" (it's superfluous)
imaploop.png
imaploop.png (16.24 KiB) Viewed 12050 times
Also see the corrected task below:

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|0
CatID=INTEGER|317955339
Comment=STRINGLIST
ContinueOnError=INTEGER|0
Events=FOLDER
ExternalName=STRING|"Task259"
Hide=INTEGER|0
ID=INTEGER|489364280
LogOnAsUser=INTEGER|1
Name=STRING|"imap mail loop test (version 2)"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|1
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER
Action9=FOLDER

[Actions\Action1]
ActionID=STRING|"A_IMAP_OPEN"
Enabled=INTEGER|-1
Name=STRING|"IMAP Open"
Params=FOLDER

[Actions\Action1\Params]
folder=STRING|"INBOX"
host=STRING|"test@test.com"
password=STRING|"4540845249455204524945520"
passwordmode=STRING|"0"
port=STRING|"993"
SSL=STRING|"1"
user=STRING|"test@test.com"

[Actions\Action2]
ActionID=STRING|"A_IMAP_LOOP"
Enabled=INTEGER|-1
Name=STRING|"IMAP Mail loop"
Params=FOLDER

[Actions\Action2\Params]
flags=STRING|"D"
from=STRING|"from"
number=STRING|"msg_num"
subj=STRING|"subj"
usecc=STRING|"0"
usedate=STRING|"0"
useflags=STRING|"0"
usefrom=STRING|"1"
usesize=STRING|"0"
usesubj=STRING|"1"
useto=STRING|"0"

[Actions\Action3]
ActionID=STRING|"A_MISC_COMMENT"
Enabled=INTEGER|-1
Name=STRING|"//Do stuff like download and parse locally and then move (copy?) and delete the message"
Params=FOLDER

[Actions\Action3\Params]
comment=STRING|"Do stuff like download and parse locally and then move (copy?) and delete the message"

[Actions\Action4]
ActionID=STRING|"A_IMAP_MOVE"
Enabled=INTEGER|-1
Name=STRING|"IMAP Move Message to Folder ""INBOX.Requests"""
Params=FOLDER

[Actions\Action4\Params]
folder=STRING|"INBOX.Requests"
msgnum=STRING|"{msg_num}"
parameters=STRING|"test.com,993,1,test@test.com"

[Actions\Action5]
ActionID=STRING|"A_IMAP_SETFLAGS"
Enabled=INTEGER|-1
Name=STRING|"IMAP Set Message Flags"
Params=FOLDER

[Actions\Action5\Params]
answered=STRING|"2"
deleted=STRING|"1"
draft=STRING|"2"
flagged=STRING|"2"
msgnum=STRING|"{msg_num}"
recent=STRING|"2"
seen=STRING|"2"

[Actions\Action6]
ActionID=STRING|"A_IMAP_SELETFOLDER"
Enabled=INTEGER|0
Name=STRING|"IMAP Select Folder: INBOX"
Params=FOLDER

[Actions\Action6\Params]
folder=STRING|"INBOX"

[Actions\Action7]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"

[Actions\Action8]
ActionID=STRING|"A_IMAP_PURGE"
Enabled=INTEGER|-1
Name=STRING|"IMAP Delete Marked Messages"

[Actions\Action9]
ActionID=STRING|"A_IMAP_CLOSE"
Enabled=INTEGER|-1
Name=STRING|"IMAP Close"

[Events]
Event1=FOLDER

[Events\Event1]
Enabled=INTEGER|0
EventID=STRING|"E_GENERAL_CYCLIC"
Params=FOLDER
UnigueID=INTEGER|861521457

[Events\Event1\Params]
id=STRING|"QH9DW3KP"
interval=STRING|"600"
notsatrtatactivation=STRING|"0"


Re: imap mail loop

Posted: Wed Jan 28, 2015 6:37 pm
by rgonzalez
Thanks for your response, I did that before but the messages are deleted at the end of the task. I need to delete each message after each loop. Is there a way to do this? Thank you!