Shoutbox

[request] email message subject to nick or psm - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: [request] email message subject to nick or psm (/showthread.php?tid=66544)

[request] email message subject to nick or psm by AberNStein on 09-22-2006 at 10:00 PM

can someone please write me a script that will take the subject (and maybe the text) of the newest message from a webmail service and make it my nickname or psm?
i'll be autoforwarding my spamoetry from gmail to another email account, so it doesn't matter what email service this is written for, so long as it's free to sign up. maybe a disposable email service with rss? i dunno.
i might give this another stab, but it feels quite out of my league, programming-wise.

thanks.


RE: [request] email message subject to nick or psm by Ezra on 09-22-2006 at 10:04 PM

Gmail has a ATOM feed to check for new e-mails, you could use that.

http://mail.google.com/mail/feed/atom

But I'm not sure how to get the cookie set that shows you are logged in.

EDIT: Little Mistake it's not an RSS Feed but ATOM.


RE: [request] email message subject to nick or psm by AberNStein on 09-22-2006 at 10:06 PM

and just mod the rss reader script? i'll check it out


RE: [request] email message subject to nick or psm by Ezra on 09-22-2006 at 10:13 PM

Yeah, or just write your own code to parse the message, isn't that hard.

I found out something that might help you. The Httprequest can accept username and password.

Use that to download the atom file to your computer, after that use the MSDOM parser to parse the subject messages.

code:
function httptest()
{
  var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  xmlhttp.Open("GET", "https://mail.google.com/mail/feed/atom", false, "username", "password");
  xmlhttp.Send();
  var Text = xmlhttp.responseText;
  //XML Object = xmlhttp.responseXML;
  Debug.Trace(Text);
}

That works :D, tested it :o
RE: [request] email message subject to nick or psm by AberNStein on 09-22-2006 at 10:21 PM

ooh that looks promising
i'll try that
the only thing is gmail truncates the bodies of the emails in the feed.
i'll have to scrape the page itself.

edit: here's what i'm currently using.
when i want to change my nick i just type /script httptest

double edit: holy shit i'm an idiot.

code:
function OnEvent_Initialize(MessengerStart)
{
}

function OnEvent_Signin(eml){
httptest();
}

function rndm(length)
{
    var randNum= Math.floor(Math.random()*length);
    return randNum;
}

function httptest()
{
  var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  xmlhttp.Open("GET", "https://mail.google.com/mail/feed/atom/spam", false, "username", "password");
  xmlhttp.Send();
  var Text = xmlhttp.responseText;
  var entries = Text.split("<entry>");
  var k = rndm(entries.length);
  var title = entries[k].substr(7,entries[k].indexOf("</title>")-7);
  var summary = entries[k].substr(entries[k].indexOf("<summary>")+9,entries[k].indexOf("</summary>")-entries[k].indexOf("<summary>")-21);
      Messenger.MyName = title;
      Messenger.MyPersonalMessage = summary;
  }

function OnEvent_Uninitialize(MessengerExit)
{
}