Check mail and download attached file

Discuss RoboTask here
Post Reply
Gekseppe
Posts: 16
Joined: Tue Sep 02, 2008 4:45 am
Location: Iceland

Check mail and download attached file

Post by Gekseppe »

Hi.

I get struck in writing a task with the following purposes:

1. Check if there are new e-mail;
2. If there are new mails then download attached file in a folder;
3. Delete e-mail.

It seems easy but, the way I did gave the following problems:

1. if there are no mails task falls in error;
2. If there are more than one mail task falls in error due to "invalid number of message".

Please could you provide a sample ?

Thank you and regards,
gekseppe
Oleg
Site Admin
Posts: 3051
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Check mail and download attached file

Post by Oleg »

See the example below:

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|0
CatID=INTEGER|1897123812
Comment=STRINGLIST
ContinueOnError=INTEGER|0
Events=FOLDER
ExternalName=STRING|"Task19"
Hide=INTEGER|0
ID=INTEGER|154598682
LocalVariables=STRING|"cnt,sz"
LogOnAsUser=INTEGER|1
Name=STRING|"Download messages from POP3"
OnErrorTaskID=INTEGER|0
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_EMAIL_OPEN"
Enabled=INTEGER|-1
Name=STRING|"POP3 Open"
Params=FOLDER

[Actions\Action1\Params]
host=STRING|"MyDomail.com"
password=STRING|"4438845245462874500344480"
port=STRING|"110"
SSL=STRING|"0"
user=STRING|"username"

[Actions\Action2]
ActionID=STRING|"A_EMAIL_COUNT"
Enabled=INTEGER|-1
Name=STRING|"POP3 Messages Count"
Params=FOLDER

[Actions\Action2\Params]
amount=STRING|"1"
amountvar=STRING|"cnt"
size=STRING|"1"
sizevar=STRING|"sz"

[Actions\Action3]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"Log Message"
Params=FOLDER

[Actions\Action3\Params]
message=STRING|"{cnt} messages. Total size {sz}"
type=STRING|"3"

[Actions\Action4]
ActionID=STRING|"A_EMAIL_LOOP"
Enabled=INTEGER|-1
Name=STRING|"POP3 Mail Loop"
Params=FOLDER

[Actions\Action4\Params]
cc=STRING|"mes_cc"
date=STRING|"mes_date"
from=STRING|"mes_from"
number=STRING|"mes_num"
size=STRING|"mes_size"
subj=STRING|"mes_subj"
to=STRING|"mes_to"
usecc=STRING|"0"
usedate=STRING|"0"
usefrom=STRING|"0"
usesize=STRING|"0"
usesubj=STRING|"0"
useto=STRING|"0"

[Actions\Action5]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"Log Message"
Params=FOLDER

[Actions\Action5\Params]
message=STRING|"Downloading and Removing {mes_num} message "
type=STRING|"3"

[Actions\Action6]
ActionID=STRING|"E_EMAIL_DOWNLOAD"
Enabled=INTEGER|-1
Name=STRING|"POP3 Download Email"
Params=FOLDER

[Actions\Action6\Params]
extract=STRING|"0"
num=STRING|"{mes_num}"
overwrite=STRING|"0"
 savetofile=STRING|"c:\incoming\{Year}{MonthNo}{Day}{Hours}{M inutes}{Seconds}{mSeconds}.eml"
 

[Actions\Action7]
ActionID=STRING|"A_EMAIL_DELETE"
Enabled=INTEGER|-1
Name=STRING|"POP3 Delete Email"
Params=FOLDER

[Actions\Action7\Params]
num=STRING|"{mes_num}"

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

[Actions\Action9]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"Log Message"
Params=FOLDER

[Actions\Action9\Params]
message=STRING|"{cnt} messages has been downloaded and removed from server"
type=STRING|"3"

[Events]
Event1=FOLDER

[Events\Event1]
Enabled=INTEGER|-1
EventID=STRING|"E_GENERAL_CYCLIC"
Params=FOLDER

[Events\Event1\Params]
id=STRING|"KAQ1D5UB"
interval=STRING|"3600"
Also you can check the existence of messages on server by using Check for Email action.
Post Reply