# Outlook Web Access sub getInfo local(info) info.name = "indiatimes" info.authors[0] = "Martin Vlcek " info.version = "0.1" info.updateService = "" info.documentationLink = "" return info end sub getExtensions return list("@indiatimes.com") end sub login(username,password) local(found,id,params,status,page,link) #--- 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 debug(true) found,link,login = match(page,"href=\"([^\"]*\?login=([^\"]*))\"") 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) page = login(username,password) found,link = match(page,"href=\"([^\"]*folder=Inbox&command=list[^\"]*)\"") 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) info("Found " & numfound & " messages.") 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\".*?

(.*?)(?:" attachpat = "HREF=\"([^\"]*/([^/\?]+)\?[^\"]*command=download[^\"]*)\"[^>]*> 0,"Message " & msg.id & " has " & numfound & " attachments (" & string(msg.attachments[].text,", ") & ")") return msg end sub delete(msgs) params["login"] = login params["button"] = "delete" params["command"] = "delete" params["folder"] = "Inbox" params["tofolder"] = "" i = 0 while (i < size(msgs)) params["messno#" & i] = msgs[i].id i = i+1 end params["currpage"] = "1" params["numberset"] = "" params["check"] = "" params["D5"] = "" params["from"] = "" params["filteraction"] = "" status,page = post("/cgi-bin/demail.cgi",params) return true end sub loginForSend(username,password) local(page,found) page = login(username,password) found,sendlink = match(page,"href=\"([^\"]*command=compose[^\"]*)\"",true) return true end sub send(msg) local(status,page,found,params,i,uparams,attachment,attachtype) debug(true) status,page = get(trim(sendlink)) #--- display attachment window: aparams["login"] = login aparams["command"] = "attach" aparams["attach1"] = "" aparams["attach2"] = "" aparams["attach3"] = "" aparams["contype1"] = "" aparams["contype2"] = "" aparams["contype3"] = "" url = geturl("/cgi-bin/demail.cgi",aparams) status,page = get(url) #--- upload attachments i = 0 while (i < size(msg.attachments)) uparams["login"] = login uparams["command"] = "attach" uparams["action"] = "upload" uparams["attach"] = "Attach to Message" status,page = upload("/cgi-bin/demail.cgi","attachfile",msg.attachments[i].link,uparams,map("Referer",url)) found,attachment = match(page,"var\s+attachfile\s*=\s*\"([^\"]*)") found,attachtype = match(page,"contype1\"\]\.value\s*=\s*\"([^\"]*)\"") params["ATTACHMENT"&(i+1)] = attachment params["contype"&(i+1)] = attachtype i = i+1 end while (i < 10) params["ATTACHMENT"&(i+1)] = "" params["contype"&(i+1)] = "" i = i+1 end params["ATTACHMENT"] = "" params["login"] = login params["command"] = "send" params["MAXFILE"] = "10" params["ln"] = "" params["TO"] = msg.to params["CC"] = msg.cc params["BCC"] = msg.bcc params["SUBJECT"] = msg.subject params["MESSAGE"] = msg.text #& "\nGet Your Private, Free E-mail from Indiatimes at http://email.indiatimes.com\n\n Buy The Best In BOOKS at http://www.bestsellers.indiatimes.com\n\nBid for for Air Tickets @ Re.1 on Air Sahara Flights. Just log on to http://airsahara.indiatimes.com and Bid Now!" #params["SENDHTML"] = "Y" params["BUTTON"] = "Send Now" status,page = post("/cgi-bin/demail.cgi",params) return (status == 200) end sub logout get(trim(logoutlink)) end