S039 pop3 - Download email throught POP3

################################;
# Download email throught POP3 #;
################################;

#Initialization;
-> "[Directory]" "/Users/jimmitry/Desktop/tmp";

#Mail download;
json load "pop3" (mail download pop3 [Directory]
3 true
{cm get "demo_cm_pop3";});

#Get mail if the number of received > 0;
if (> (json select "pop3" "/NbReceived") 0) {

	#Get the file directory;
	json load "files" (file dir_list [Directory]);

	#Get mails;
	-> "[nb_files]" (json count "files" /);
	for (-> "[i]" 0) (< [i] [nb_files]) (++ "[i]") {
	
		-> "[cur_filename]" (json select "files" (concat "/[" [i] "]"));

		#Load the mail;
		json load "mail" (concat [Directory] "/" [cur_filename]);
		
		#Here your action;
		
		
	};

};


MentDB © 2012 - 2020 - Legal Notice