Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > go to a link, save the page and email it out?

Reply
Thread Tools

go to a link, save the page and email it out?

 
 
dale
Guest
Posts: n/a
 
      12-14-2004
Hi,

Does anyone know if there is a perl module to do the above?
Thanks. -Dale

 
Reply With Quote
 
 
 
 
Matija Papec
Guest
Posts: n/a
 
      12-14-2004
X-Ftn-To: dale

"dale" <(E-Mail Removed)> wrote:
>Does anyone know if there is a perl module to do the above?


HTML::Mail works nicely.



--
Matija
 
Reply With Quote
 
 
 
 
Christopher Nehren
Guest
Posts: n/a
 
      12-14-2004
On 2004-12-14, dale scribbled these
curious markings:
> Does anyone know if there is a perl module to do the above?
> Thanks. -Dale


package MailPage;
use strict;
use warnings FATAL => 'all';

use LWP::Simple;
use MIME::Lite;
use Carp;
use base qw/Exporter/;
use vars qw/@EXPORT_OK/;
@EXPORT_OK = qw/mail_page/;

sub mail_page
{
croak "mail_page needs four arguments!" unless @_ == 4;
my ($page, $from, $to, $subject) = @_;
my $content = get($page);
croak "Couldn't fetch $page!" unless defined $content;
my $msg = MIME::Lite->new
(
From => $from,
To => $to,
Subject => $subject,
Data => $content,
);
$msg->send() or carp "Uh oh, problems sending mail!"
}
1;
__END__

#!/usr/bin/perl
use strict;
use warnings FATAL => 'all';

use MailPage qw/mail_page/;
mail_page(q#http://www.google.com#, q#(E-Mail Removed)#,
q#(E-Mail Removed)#, q#A Test#);

__END__

WFM. Took about 5 minutes (mostly because I'm not too familiar with most
of the modules used).

/me braces for the inevitable torrent of code review he's going to
receive...

Best Regards,
Christopher Nehren
--
I abhor a system designed for the "user", if that word is a coded
pejorative meaning "stupid and unsophisticated". -- Ken Thompson
If you ask the wrong questions, you get answers like "42" and "God".
Unix is user friendly. However, it isn't idiot friendly.
 
Reply With Quote
 
Christopher Nehren
Guest
Posts: n/a
 
      12-14-2004
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2004-12-14, Christopher Nehren scribbled these
curious markings:
> $msg->send() or carp "Uh oh, problems sending mail!"

^^^^

Self-review: that should probably be croak.

Best Regards,
Christopher Nehren
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (FreeBSD)

iD8DBQFBvy8+k/lo7zvzJioRAq4RAKCZDdQsKGN3Qwt526VnfKUfaXss+QCgluo4
Uzpdd3l6dWZ7lutd+tTY288=
=JDeH
-----END PGP SIGNATURE-----

--
I abhor a system designed for the "user", if that word is a coded
pejorative meaning "stupid and unsophisticated". -- Ken Thompson
If you ask the wrong questions, you get answers like "42" and "God".
Unix is user friendly. However, it isn't idiot friendly.
 
Reply With Quote
 
dale
Guest
Posts: n/a
 
      12-15-2004
HTML::Mail works for some web sites. But some web sites have
protections for reading some files, which is expected. 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>

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

Thanks a lot. -Dale

 
Reply With Quote
 
dale
Guest
Posts: n/a
 
      12-15-2004
HTML::Mail works for some web sites. But some web sites have
protections for reading some files, which is expected. 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>

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

Thanks a lot. -Dale

 
Reply With Quote
 
dale
Guest
Posts: n/a
 
      12-15-2004
Tried the simple one.

HTML::Mail works for some web sites. But some web sites have
protections for reading some files, which is expected. 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>

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

Thanks a lot. -Dale

 
Reply With Quote
 
dale
Guest
Posts: n/a
 
      12-15-2004
Thank you all. I tried HTML::Mail, it worked. It is simple.

-Dale

 
Reply With Quote
 
dale
Guest
Posts: n/a
 
      12-15-2004
Thank you all. I tried HTML:Mail and worked. It is simple.

-Dale

 
Reply With Quote
 
dalewz@gmail.com
Guest
Posts: n/a
 
      12-15-2004
HTML::Mail works for some web sites. But some web sites have
protections for reading some files, which is expected. 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to automatically "Save " a page after certain intervals without clicking "Save Page As..." subhadip Java 0 03-28-2007 04:15 PM
Save contents of iframe from parent's save button user ASP .Net 1 04-04-2005 07:44 PM
How to go to a link and save a page and email it out? dalewz@gmail.com Perl Misc 2 12-16-2004 04:02 PM
Follow-up:go to a link, save the page and email it out? dale Perl Misc 1 12-16-2004 12:07 PM
beside save as htm and txt in IE , can i save as jpeg or other formats ? hycn office ASP General 2 10-10-2003 12:57 PM



Advertisments