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

use HTML::Mail;
use strict;

# Misc stuff
# Read sendpage first

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 = HTML::Mail->new(
    HTML    => $url,
    Text    => "This is the alternative text.\nPlease visit $url\n",
    From    => 'plank@cpan.org',
    To      => $email,
    Subject => "Mail with $url",
);

$html_mail->send();
$html_mail->build(Text=>undef, inline_css=>0);
$html_mail->send;

#try to attach some linked content
$html_mail->build(attach_links => sub{my $uri = shift; return $uri =~ /\.gif$/});
$html_mail->send;
