Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Poll mailinator.com

by Corion (Pope)
on Feb 12, 2013 at 19:16 UTC ( #1018429=CUFP: print w/ replies, xml ) Need Help??

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

Comment on Poll mailinator.com
Download Code
Re: Poll mailinator.com
by grondilu (Pilgrim) on Mar 19, 2013 at 02:40 UTC

    Haven't tested it, but just from the description, I'd say it's pretty neat.

      Is it safe to assume that this code would be useful for a Mailinator Pro (any level) subscription?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: CUFP [id://1018429]
Approved by GrandFather
Front-paged by ww
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (7)
As of 2014-10-23 05:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (124 votes), past polls