How to go to a link and save a page and email it out?

Discussion in 'Perl Misc' started by dalewz@gmail.com, Dec 15, 2004.

  1. Guest

    Thanks for helps here. I tried the simple method - HTML::Mail.

    HTML::Mail works for some web sites. But it does not work for some. The
    results are:

    C:\Perl\scripts>mailp.pl
    Error while making request [ GET
    http://www.macom.com/Images/darkblue_bgcolor.gi
    f]
    404 Object Not Found at C:/Perl/lib/HTML/Mail.pm line 167.

    C:\Perl\scripts>

    -----Mail.pm
    164 my $response = $self->{'_ua'}->get($uri);
    165
    166 if (!$response->is_success) {
    167 die "Error while making request [ GET ", $response->request->uri,
    "]\n", $response->status_line;
    168 }

    However, if I use IE to open www.macom.com, I can save the page with
    all images. Any suggestions?

    Thanks a lot. -Dale
    PS> my script is:
    use HTML::Mail;

    ### initialisation
    my $html_mail = HTML::Mail->new(
    HTML => 'http://www.macom.com',
    >From => '',

    To => ', ',
    Subject => 'Alert page');

    ### Send the email ("inherited" from MIME::Lite)
    # $html_mail->send();
    $html_mail->send('smtp','outgoing.verizon.net');

    #### Remove text representation
    $html_mail->set_Text();

    ### Rebuild the message and send
    $html_mail->build->send;

    ### Serialise to file for later reuse
    $html_mail->dump_file('c:/html_mail.data');

    ### Restore from file
    my $restored = HTML::Mail->restore_file('c:/html_mail.data');
     
    , Dec 15, 2004
    #1
    1. Advertisements

  2. Matt Garrish Guest

    <> wrote in message
    news:...
    > Thanks for helps here. I tried the simple method - HTML::Mail.
    >
    > HTML::Mail works for some web sites. But it does not work for some. The
    > results are:
    >
    > C:\Perl\scripts>mailp.pl
    > Error while making request [ GET
    > http://www.macom.com/Images/darkblue_bgcolor.gi
    > f]
    > 404 Object Not Found at C:/Perl/lib/HTML/Mail.pm line 167.
    >


    Did you maybe stop and think that the image isn't there? It really doesn't
    matter that you can open the page in IE and it looks okay to your eyes, as
    that has nothing to do with whether the image exists or not.

    The image doesn't exist, by the way, so you either go back to the drawing
    board, modify the code not to die if the image is missing, or email the
    author and ask him to.

    Matt
     
    Matt Garrish, Dec 16, 2004
    #2
    1. Advertisements

  3. dale Guest

    Thank you all for the helps. I have found the solution by using
    WWW::Mechanize. It is really cool.

    -Dale
     
    dale, Dec 16, 2004
    #3
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Silver
    Replies:
    0
    Views:
    807
    John Silver
    Feb 4, 2005
  2. =?Utf-8?B?c2FtZWVy?=
    Replies:
    1
    Views:
    1,053
    Bruce Barker
    Oct 4, 2005
  3. Flatch U. Lance
    Replies:
    7
    Views:
    1,229
    Flatch U. Lance
    Mar 4, 2006
  4. subhadip
    Replies:
    0
    Views:
    776
    subhadip
    Mar 28, 2007
  5. Zeynel
    Replies:
    1
    Views:
    704
    alex23
    Dec 6, 2010
  6. Carl Gilbert

    Link to run script and link to page

    Carl Gilbert, Jan 13, 2004, in forum: Javascript
    Replies:
    3
    Views:
    284
    Michael Winter
    Jan 13, 2004
  7. dale
    Replies:
    10
    Views:
    266
    Matija Papec
    Dec 17, 2004
  8. dale
    Replies:
    1
    Views:
    178
    Anno Siegel
    Dec 16, 2004
Loading...