To find the correct URL to pass your login parameters, you could go look at the page you use to login to your webmail. Then either watch the headers go by or parse the source, your call.

Personally, I'd use WWW::Mechanize to handle this all automatically.

Quick plan:

  1. get the url of the page you eventually want within your webmail setup.
  2. logout of webmail, and try opening that page. Do you get sent to a login form? Good. What does the login form look like? A form with the words "LOGIN" or somesuch?
  3. login to the form. Does it take you back to the page your requested? Yes is good. No is ok too.
  4. Now do it again via WWW::Mechanize
  5. ...
  6. profit
#!/usr/bin/perl -w use strict; use WWW::Mechanize; my $target_url = "https://webmail.com/the/page/I/want"; my $user = "myusername"; my $pass = "<=6chars"; my $ua = WWW::Mechanize->new(); my $resp = $ua->get( $target_url ); #Dear student, check here that resp is valid... #check if page looks like the login page, by looking for a field named + "login" if ( $ua->form_name("login") ) { $ua->field( "username", $user ); #look for a field named "username" $ua->field( "password", $pass ); #look for a field named "password" $ua->submit(); #submit the form } #$ua should now have the comment you were hoping for.

In reply to Re: WebMail authentication by spazm
in thread WebMail authentication by plink

Title:
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, details, 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, summary, 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.