Posts Tagged fetch

Forwarding or fetching your hotmail

Posted by on Tuesday, 7 April, 2009

#!/usr/bin/perl -w
#
# You need to install this perl module below and openssl, crypt, mechanize also
use WWW::Hotmail;

my $hotmail = WWW::Hotmail->new();

$hotmail->login(‘username@hotmail.com’, “pass123”)
or die $WWW::Hotmail::errstr;

my @msgs = $hotmail->messages();
die $WWW::Hotmail::errstr if ($!);

print “You have “.scalar(@msgs).” messages\n”;

for (@msgs) {
print “message from “.$_->from.”\n”;
# retrieve the message from hotmail
my $mail = $_->retrieve;
# deliver it locally – you may wanna hash this out 🙂
$mail->accept;
# forward the message
$mail->resend(‘username@gmail.com’);
# delete it from the inbox
$_->delete;
}