#!/usr/bin/perl -W
use lib '../lib';

use HTML::Mail;
use strict;

#Send's an email with a webpage included

if ( $#ARGV != 1 ) {
    print <<EOF;
Usage sendpage url email

sendpage http://www.cpan.org receipient\@domain.org

EOF
    exit 0;
}

my $url   = shift;
my $email = shift;

### initialisation
my $html_mail = new HTML::Mail(
    HTML    => $url,
    Text    => "This is the alternative text.\nPlease visit $url\n",
    From    => 'plank@cpan.org',
    To      => $email,
    Subject => "Mail with $url",
	#uncomment to not attach external media
	#'attach_uri' => sub {my $uri = shift; return $uri->scheme !~ /http/}
);

$html_mail->send();
