Gnus development mailing list
 help / color / mirror / Atom feed
* Gnus-ing your hotmail..
@ 1997-10-30 19:10 Andy Eskilsson
  1997-11-02  3:51 ` SL Baur
  1997-11-05 13:08 ` Lars Magne Ingebrigtsen
  0 siblings, 2 replies; 7+ messages in thread
From: Andy Eskilsson @ 1997-10-30 19:10 UTC (permalink / raw)


*phew* Well finally got it there:
	http://www.fukt.hk-r.se/~flognat/hacks/

hotmail.tgz, contains a python-script for fetching your mail at
hotmail, and putting it into a unix-folder, or nnmh-like structure..  

It really rocks :-)

There is only one catch, you need either python 1.5 (alfas not public
available, beta will soon be released), or python 1.4 with the new
pcre module, more info can be found in hotmail.py

Now, I only miss the ability to post from gnus to hotmail!

Ahh well.. 

	/andy


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Gnus-ing your hotmail..
  1997-10-30 19:10 Gnus-ing your hotmail Andy Eskilsson
@ 1997-11-02  3:51 ` SL Baur
  1997-11-03  7:31   ` Andy Eskilsson
  1997-11-05 13:08 ` Lars Magne Ingebrigtsen
  1 sibling, 1 reply; 7+ messages in thread
From: SL Baur @ 1997-11-02  3:51 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 163 bytes --]

Andy Eskilsson <andy.eskilsson@telelogic.se> writes:

> Now, I only miss the ability to post from gnus to hotmail!

You might find the attached script useful ...


[-- Attachment #2: Type: message/rfc822, Size: 9483 bytes --]

From: iang@cs.berkeley.edu (Ian Goldberg)
To: cypherpunks@cyberpass.net
Subject: sendhotmail, version 1.3
Date: 13 Aug 1997 22:45:26 GMT
Message-ID: <5stde6$tdc$1@abraham.cs.berkeley.edu>


And here's 1.3.  It uses the same config file as 1.2.

New:

o fixes a bug involving + in email addresses
o handles continuation headers properly
o Can be used as a drop-in replacement for sendmail (though it may get confused
  if you pass weird sendmail options); it will keep trying random hotmail
  accounts and proxies until it succeeds in delivering the mail.  Note that,
  depending on your connectivity, this can take a while...

   - Ian

#!/usr/bin/perl -w

##
## sendhotmail: pipe an RFC822 mail message into this, and it will send it
##              out from a hotmail account via an HTTP proxy
##
## Version 1.3: 19970813
##
## Program by Ian Goldberg <ian@cypherpunks.ca>
##

sub Usage {
    die "Usage: $0 -t | addr\@host ...\n";
}

## Check options
$cmdlineto = '';
while ($#ARGV >= 0 && $ARGV[0] =~ /^-/o) {
    $_ = shift @ARGV;
    if ($_ eq "-t") {
	$cmdlineto = '';
    } elsif ($_ eq "-f") {
	shift @ARGV;
    } else {
	## Ignore option
    }
}
if ($#ARGV >= 0) {
    $cmdlineto = join(", ", @ARGV);
}

use LWP;

$uadirect = new LWP::UserAgent;

## The filename of the configuration file
$configfile = '/home/iang/sendhotmail/config';

## Read the config file
open(CONFIG, $configfile) or die "Cannot open $configfile: $!\n";
while(<CONFIG>) {
    next if /^\s*$/o;
    next if /^\s*\#/o;
    next unless /^([^:]+):\s*(.*)$/o;
    $value = $2;
    $name = "\L$1\E";
    $name =~ s/[^a-z0-9]//iog;
    $config{$name} = $value;
}
close(CONFIG);

sub escapetext {
    my $t = $_[0];
    $t =~ s/([\000-\037\200-\377\{\}\|\\\^\[\]\`\"\<\>\:\@\/\;\?\=\&\%\.\#\+])/"%".unpack('H2',$1)/eg;
    $t =~ s/ /+/g;
    $t;
}

sub getaddrs {
    my @addrlist = split(/,\s*/, $_[0]);
    my ($a, $ra);
    my @r;

    foreach $a (@addrlist) {
	$ra = '';
	if ($a =~ /\<(.*?)\>/) {
	    $ra = $1;
	} else {
	    $a =~ s/\(.*?\)//g;
	    $a =~ s/\".*?\"//g;
	    $ra = $1 if $a =~ /(\S+\@\S+)/;
	}
	push (@r, $ra) if $ra ne '';
    }
    join(', ', @r);
}

## Parse the incoming mail.  We need to put the To, Cc, and Bcc headers
## into a simple format that hotmail can understand.

$header{'to'} = '';
$header{'subject'} = '';
$header{'cc'} = '';
$header{'bcc'} = '';
$curheader = '';
while(<STDIN>) {
    last if /^$/;
    chomp;
    if (/^\S/) {
	## Start a new header
	if (s/^To:\s*//io) {
	    $curheader = 'to';
	    $header{'to'} .= ', ' if $header{'to'} ne '';
	} elsif (s/^Cc:\s*//io) {
	    $curheader = 'cc';
	    $header{'cc'} .= ', ' if $header{'cc'} ne '';
	} elsif (s/^Bcc:\s*//io) {
	    $curheader = 'bcc';
	    $header{'bcc'} .= ', ' if $header{'bcc'} ne '';
	} elsif (s/^Subject:\s*//io) {
	    $curheader = 'subject';
	} else {
	    $curheader = '';
	}
    }
    if ($curheader ne '') {
	s/^\s*//;
	$header{$curheader} .= ' ' if $header{$curheader} ne '';
	$header{$curheader} .= $_;
    }
}
## If we were given command-line addresses, that overrides the headers
$header{'to'} = &getaddrs($cmdlineto eq '' ? $header{'to'} : $cmdlineto);
$header{'cc'} = &getaddrs($cmdlineto eq '' ? $header{'cc'} : '');
$header{'bcc'} = &getaddrs($cmdlineto eq '' ? $header{'bcc'} : '');

$msg = &escapetext(join('', <STDIN>));

srand(time ^ $$);

## Keep trying until the message is successfully delivered
RETRYLOOP: while (1) {

## Get the proxy list
$proxylisturl = new URI::URL ($config{'proxylisturl'} ||
		'http://www.publius.net/~remailer/proxy_list.txt');
if (defined $config{'proxylistcachefile'}) {
    ## Check if the locally cached copy is new enough
    $maxage = $config{'proxylistcacheage'} || 1;
    if (! -e $config{'proxylistcachefile'} ||
	    -M $config{'proxylistcachefile'} > $maxage) {
	## Fetch a new copy
	$request = new HTTP::Request('GET', $proxylisturl);
	$request->header(Pragma => 'no-cache');
	$response = $uadirect->request($request);
	$body = $response->content;
	$newfname = $config{'proxylistcachefile'}.".new.$$";
	open(CACHE, ">$newfname") or die "Cannot write $newfname: $!\n";
	print CACHE $body;
	close(CACHE);
	rename($newfname, $config{'proxylistcachefile'}) or
	    die "Cannot rename $newfname: $!\n";
    }
    ## Read the proxy list
    open(CACHE, $config{'proxylistcachefile'}) or
	die "Cannot open $config{'proxylistcachefile'}: $!\n";
    @proxylist = grep (s/\n// && /^[^#]/, <CACHE>);
    close(CACHE);
} else {
    ## Just fetch from the net
    $request = new HTTP::Request('GET', $proxylisturl);
    $request->header(Pragma => 'no-cache');
    $response = $uadirect->request($request);
    @proxylist = grep (/^[^#]/, split("\n", $response->content));
}

@proxylist = ('secure.escape.ca:80') if $#proxylist == -1;

## Get the account list
if (defined $config{'accountlistfile'}) {
    open(ACC, $config{'accountlistfile'}) or
	die "Cannot open $config{'accountlistfile'}: $!\n";
    @accountlist = grep (s/\n// && /^[^#]/, <ACC>);
    close(ACC);
}

@accountlist = ('ldeliverer:xxxx') if $#accountlist == -1;

## Choose a proxy and account at random

$proxy = $proxylist[int rand ($#proxylist+1)];
($login, $passwd) =
    $accountlist[int rand ($#accountlist+1)] =~ /^([^:]*):(.*)$/;

#print STDERR "Trying $login through $proxy\n";

## Begin hotmail-specific magic

$ua = new LWP::UserAgent;
$ua->proxy('http', "http://${proxy}/");

$url = new URI::URL 'http://www.hotmail.com/cgi-bin/password.cgi';
$request = new HTTP::Request('POST', $url);
$request->header(Pragma => 'no-cache');
$request->content("login=${login}&curmbox=ACTIVE");

$response = $ua->request($request);
$body = $response->content;
$body =~ /\<\s*form\s+[^>]*action=\"(.*?)\"/io or next RETRYLOOP;

$url = new URI::URL $1, $url;
$body = $';
$body =~ s/\<\s*\/form\s*\>.*//;
$body =~ /\<\s*input\s+[^>]*name=\"disk\"\s+value(=\"(.*?)\")?/io or next RETRYLOOP;
$disk = $2 || "";

$request = new HTTP::Request('POST', $url);
$request->header(Pragma => 'no-cache');
$request->content("passwd=${passwd}&frames=no&disk=${disk}&curmbox=ACTIVE&login=${login}&js=no");
$response = $ua->request($request);
$body = $response->content;

$body =~ /\<\s*area\s+[^>]*href=\"(\/cgi-bin\/compose.*?)\"/io or next RETRYLOOP;
$composeurl = new URI::URL $1, $url;
$body =~ /\<\s*area\s+[^>]*href=\"(\/cgi-bin\/logout.*?)\"/io or next RETRYLOOP;
$logouturl = new URI::URL $1, $url;

$request = new HTTP::Request('GET', $composeurl);
$request->header(Pragma => 'no-cache');
$response = $ua->request($request);
$body = $response->content;

$body =~ /\<\s*form\s+[^>]*action=\"(.*?)\".*?\>/io or next RETRYLOOP;
$url = new URI::URL $1, $composeurl;
$body = $';
$data = '';
while(1) {
    $body =~ /^\s*\<\s*input\s+type=\"?hidden\"?\s+name=\"(.*?)\"\s+value(=\"(.*?)\")?\s*\>/io or last;
    $name = $1; $value = $3 || ""; $body = $';
    $data .= $name."=".$value."&";
}
$data .= "to=$header{'to'}&subject=$header{'subject'}&cc=$header{'cc'}&bcc=$header{'bcc'}&body=${msg}&Send.x=1&Send.y=1";

$request = new HTTP::Request('POST', $url);
$request->header(Pragma => 'no-cache');
$request->content($data);
$response = $ua->request($request);
$body = $response->content;
$body =~ /\<\s*title\s*\>\s*Hotmail\s*-\s*Mailbox/io or next RETRYLOOP;

$request = new HTTP::Request('GET', $logouturl);
$request->header(Pragma => 'no-cache');
$response = $ua->request($request);
last RETRYLOOP;  ## Success
}


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Gnus-ing your hotmail..
  1997-11-02  3:51 ` SL Baur
@ 1997-11-03  7:31   ` Andy Eskilsson
  1997-11-03 12:54     ` Kai Grossjohann
  0 siblings, 1 reply; 7+ messages in thread
From: Andy Eskilsson @ 1997-11-03  7:31 UTC (permalink / raw)


/ SL Baur <steve@xemacs.org> wrote:
| [1  <text/plain; US-ASCII (7bit)>]
| Andy Eskilsson <andy.eskilsson@telelogic.se> writes:
| 
| > Now, I only miss the ability to post from gnus to hotmail!
| 
| You might find the attached script useful ...
| 

Hmm weeh :-) Some code I can look at and reuse :-) But what I meant
was some functionality _from_ gnus so I can use my script to post..

Ahh well :-) Thanx!

	/andy


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Gnus-ing your hotmail..
  1997-11-03  7:31   ` Andy Eskilsson
@ 1997-11-03 12:54     ` Kai Grossjohann
  0 siblings, 0 replies; 7+ messages in thread
From: Kai Grossjohann @ 1997-11-03 12:54 UTC (permalink / raw)
  Cc: ding

>>>>> On 03 Nov 1997, Andy Eskilsson said:

  Andy> Hmm weeh :-) Some code I can look at and reuse :-) But what I
  Andy> meant was some functionality _from_ gnus so I can use my
  Andy> script to post..

Hm?  Gnus uses sendmail.el to send mail, and sendmail.el calls
sendmail, right?  So you just tell sendmail.el to call sendhotmail,
instead, right?

kai
-- 
~/.signature: No such file or directory


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Gnus-ing your hotmail..
  1997-10-30 19:10 Gnus-ing your hotmail Andy Eskilsson
  1997-11-02  3:51 ` SL Baur
@ 1997-11-05 13:08 ` Lars Magne Ingebrigtsen
  1997-11-05 20:36   ` Stefan Waldherr
  1 sibling, 1 reply; 7+ messages in thread
From: Lars Magne Ingebrigtsen @ 1997-11-05 13:08 UTC (permalink / raw)


Andy Eskilsson <andy.eskilsson@telelogic.se> writes:

> hotmail.tgz, contains a python-script for fetching your mail at
> hotmail, and putting it into a unix-folder, or nnmh-like structure..  
> 
> It really rocks :-)

I'm sure it does, but what is "hotmail"?

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Gnus-ing your hotmail..
  1997-11-05 13:08 ` Lars Magne Ingebrigtsen
@ 1997-11-05 20:36   ` Stefan Waldherr
  1997-11-06 10:43     ` SL Baur
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Waldherr @ 1997-11-05 20:36 UTC (permalink / raw)


>>>>> "Lars" == Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

    Lars> Andy Eskilsson <andy.eskilsson@telelogic.se> writes:
    >> hotmail.tgz, contains a python-script for fetching your mail at
    >> hotmail, and putting it into a unix-folder, or nnmh-like structure..
    >> 
    >> It really rocks :-)

    Lars> I'm sure it does, but what is "hotmail"?

www.hotmail.com. get an email mailbox for free.

S.
-- 
Stefan Waldherr                office +1 (412) 268-3837
                                  fax +1 (412) 268-5576
                               e-Mail swa@cs.cmu.edu
                                  www http://www.waldherr.org/


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Gnus-ing your hotmail..
  1997-11-05 20:36   ` Stefan Waldherr
@ 1997-11-06 10:43     ` SL Baur
  0 siblings, 0 replies; 7+ messages in thread
From: SL Baur @ 1997-11-06 10:43 UTC (permalink / raw)


Stefan Waldherr <swa@cs.cmu.edu> writes:

>>>>>> "Lars" == Lars Magne Ingebrigtsen <larsi@gnus.org> writes:
Lars> I'm sure it does, but what is "hotmail"?

> www.hotmail.com. get an email mailbox for free.

It's quite interesting actually.  I have a hotmail mailbox.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~1997-11-06 10:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-10-30 19:10 Gnus-ing your hotmail Andy Eskilsson
1997-11-02  3:51 ` SL Baur
1997-11-03  7:31   ` Andy Eskilsson
1997-11-03 12:54     ` Kai Grossjohann
1997-11-05 13:08 ` Lars Magne Ingebrigtsen
1997-11-05 20:36   ` Stefan Waldherr
1997-11-06 10:43     ` SL Baur

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).