Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Comment on

( #3333=superdoc: 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 to create disposable email addresses. As I'm also lazy and didn't want to visit, I wrote the following script which generates a random email address and polls that inbox on, 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||= ''; $domain||= ''; 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

In reply to Poll by Corion

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    [jdporter]: erix - excellent. thanks! davido - no; just reminiscing. :-)

    How do I use this? | Other CB clients
    Other Users?
    Others drinking their drinks and smoking their pipes about the Monastery: (7)
    As of 2018-06-21 17:00 GMT
    Find Nodes?
      Voting Booth?
      Should cpanminus be part of the standard Perl release?

      Results (118 votes). Check out past polls.