# Indiatimes # supports receiving of mail with attachments # supports sending of text mail (attachments don't work?) # # @Requires: 1.1 beta3 # @Version: 1.1.1 # german texts (with MrPostman 1.2.2+) # @Version: 1.1 # webmail change: login updated sub getInfo local(info) info.name = "indiatimes" info.authors[0] = "Martin Vlcek " info.version = "1.1.1" info.updateService = "" info.documentationLink = "" info.options["maxNum"].order = 1 info.options["maxNum"].value = 1000 info.options["maxNum"].label = "Max Number of Messages" info.options["maxNum"].description = "The maximum number of messages to check for retrieval" #--- german texts info.options["maxNum"].de.label = "Max. Anzahl Nachrichten" info.options["maxNum"].de.description = "Die maximale Anzahl von Nachrichten, die überprüft bzw. heruntergeladen werden sollen" return info end sub getExtensions return list("@indiatimes.com") end sub login(username,password) local(found,id,params,status,page,link) #debug(true) #--- set some basic settings to allow MrPostman doing some conversions, ... setbaseurl("http://email.indiatimes.com/") size.locale = "en" size.unit[""] = 1024 date.locale = "en" date.format = "EEE, d MMM yyyy HH:mm:ss Z" #--- let's log in: found,id = match(username,"(.*)@") params["login"] = id params["passwd"] = password params["Sign in"] = "true" status,page = post("/cgi-bin/login",params) #--- this is the promotion page #found,link,login = match(page,"href=\"([^\"]*\?login=([^\"]*))\"") #--- this is a meta tag redirect found,link,login = match(page,"url=\s*([^\s]*\?login=([^\"\s]*))[\"\s]") login = trim(login) status,page = get(trim(link)) logoutlink = geturl(trim(link),map("command","logout")) #--- this is the start page, from here you can write a mail or go to the inbox return page end sub loginForReceive(username,password) local(page,found,link,msgpat,numfound,pagenum,msgs1) page = login(username,password) found,link = match(page,"href=\"([^\"]*folder=Inbox&command=list[^\"]*)\"") returnif(!found,false) status,page = get(trim(link)) #--- finally we are at the inbox page: get the messages msgpat = "MAILS\".*?\"([^\"]*command=show[^\"]*messno=(\d+)[^\"]*)\".*?SIZE\">([^<]+)()<" numfound,msgs[].link,msgs[].id,msgs[].size.value,msgs[].size.unit = matchall(page,msgpat) #--- check for more pages pagenum = 2 found,link = match(page,"href=\"([^\"]*folder=Inbox&viewno=" & pagenum & "[^\"]*)\"") while (found and size(msgs)+1 < integer(info.options["maxNum"].value)) msgs1 = list() status,page = get(trim(link)) numfound,msgs1[].link,msgs1[].id,msgs1[].size.value,msgs1[].size.unit = matchall(page,msgpat) msgs = join(msgs,msgs1) pagenum = pagenum + 1 found,link = match(page,"href=\"([^\"]*folder=Inbox&viewno=" & pagenum & "[^\"]*)\"") end return true end sub receive(msg) local(status,page,found,attachpat,numfound) info("Getting message " & msg.id & "...") status,page = get(msg.link) found,msg.from = match(page,"MS1\">From:.*?MS3\">([^<]*)<") found,msg.to = match(page,"MS1\">To:.*?MS3\">([^<]*)<") found,msg.cc = match(page,"MS1\">CC:.*?MS3\">([^<]*)<") found,msg.bcc = match(page,"MS1\">BCC:.*?MS3\">([^<]*)<") found,msg.subject = match(page,"MS1\">Subject:.*?MS3\">(?:<[^>]*>)?([^<]*)Date:.*?MS3\">([^<]*)<") found,msg.text = match(page,"MS2\".*?

(.*?)(?:Subject.*?\s*     \s*(.*?)(?:" attachpat = "HREF=\"([^\"]*/([^/\?]+)\?[^\"]*command=download[^\"]*)\"[^>]*>