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

D

dalewz

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 => '(e-mail address removed)',
To => '(e-mail address removed), (e-mail address removed)',
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');
 
M

Matt Garrish

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
 
D

dale

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

-Dale
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,586
Members
45,088
Latest member
JeremyMedl

Latest Threads

Top