#!/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 recepient\@domain.org

EOF
    exit 0;
}

my ($url, $email) = @ARGV;

### 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/}
	
	#uncomment to not die on failled downloading of media
	#'strict_download' => 0,
);

$html_mail->send();
#$html_mail->send('smtp', "cpan.mx.develooper.com");
