Recently, I've signed up for some forums, just to read their posts.
As I'm not interested in having my email address sold, I used http://mailinator.com to create
disposable email addresses. As I'm also lazy and didn't want to visit
http://mailinator.com, I wrote the following script which generates a random
email address and polls that inbox on mailinator.com, printing all HTTP links
found in every mail, in the assumption that one of them is the signup/verification link
mailed.
Update: Mailinator is for Humans points out
that they've cut the POP3 access and likely will cut all other "machine-only" access soon. So I won't bother porting
this to consume the RSS feed. Sad that we can't have nice things.
#!perl -w
use strict;
use Net::POP3;
use MIME::Parser;
use URI;
use App::scrape 'scrape';
use Getopt::Long;
use Pod::Usage;
GetOptions(
's|server:s' => \my $server,
'd|domain:s' => \my $domain,
'm|mailbox:s' => \my $mailbox,
't|sleep:s' => \my $delay,
) or pod2usage(1);
$server||= 'pop.mailinator.com';
$domain||= 'mailinator.com';
if( ! defined $delay) {
$delay = 45;
};
my @letters = ('a'..'z','0'..'9');
$mailbox ||= join '', map { $letters[ rand 0+@letters ] } 1..12;
print "$mailbox\@$domain\n";
sleep $delay+rand(5);
#while( 1 ) {
poll();
#sleep 45+rand(5);
#};
sub poll {
my $connection= Net::POP3->new( $server );
if( $connection->login( $mailbox => 'xxxxxxxx' )> 0) {
my $messages= $connection->list;
for my $id (sort keys %$messages) {
my $msg= $connection->get($id);
my $mime= MIME::Parser->new();
my $raw= join '', @$msg;
my $entity= $mime->parse_data( \$raw );
print $entity->head->get('subject'),"\n";
print $entity->head->get('from'),"\n";
(my $payload)= grep { $_->bodyhandle } ($entity, $entity->
+parts());
my $body= $payload->bodyhandle->as_string;
if( 'text/html' eq $payload->effective_type ) {
print "$_\n" for map { @$_ } scrape( $body, ['a@href']
+, { base => 'xxx' } );
} else {
print "$_\n" for $body=~ m!(https?://[^\s]+)!g;
};
};
};
$connection->quit;
};
=head1 NAME
anon-signup - poll a mailinator email address for HTTP links
=cut