Created
November 19, 2009 15:39
-
-
Save rybesh/238824 to your computer and use it in GitHub Desktop.
download and mail a web page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
use strict; | |
use WWW::Mechanize; | |
use MIME::Lite; | |
my $from = shift; | |
my $to = shift; | |
my $url = shift; | |
my $title = shift; | |
my $mech = WWW::Mechanize->new(); | |
$mech->get($url); | |
my $html = $mech->content; | |
my $base = $mech->base; | |
$html =~ s|</head>|'<base href="'.$base.'"></head>'|eigs; | |
my $msg = MIME::Lite->new ( | |
From => $from, | |
To => $to, | |
Subject => $title, | |
Type => 'multipart/mixed'); | |
$msg->attach ( | |
Type => 'text/html', | |
Data => qq{$html}); | |
MIME::Lite->send('smtp', 'localhost', Timeout=>60); | |
$msg->send; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment