use MIME::Base64;
use MIME::Lite;
# Les variables suivantes peuvent être initialisées dans votre script
# ou transmises en paramètre
$username = "football\@domain.com";
$password = "unix du buro";
$smtpserver = "relay.mail.gandi.net";
$from = "football\@domain.com";
$replyto = "monadresse\@toto.com";
$to = 'mon.addresse@gmail.com'; # use ; between email adresses
$cc = "mon.addresse\@laposte.net; my.address\@laposte.net";
$bcc = "football\@domain.com";
$subject = "Black Perl mimemail.pl";
$text = "C'était très bien, je te raconterai...\n\n\n\n\nCool.\n\nGros Bisous\n\n";
$message = "<h1>Test Email</h1>";
$message = $message . "<b><u>Ceci est un document HTML</u></b> <img src=\"cid:840.jpg\"><br>";
$message = $message . 'Avec differentes tailles de caracteres et <font color="red">couleurs</font>' ;
$mime = MIME::Lite->build(
From => "$from",
To => "$to",
"Reply-To" => "$replyto",
Cc => "$cc",
Bcc => "$bcc",
Subject => "$subject",
"X-Mailer" => 'San Diego mimemail.pl v1.1',
Type => 'multipart/related',
);
$mime->attach(
Type => 'text/plain; charset="utf8"',
Encoding => 'quoted-printable',
Data => $text
);
#$html=encode_base64($message);
$mime->attach(
Type => 'text/html',
Encoding => 'quoted-printable',
Data => "$message"
);
$mime->attach(
Disposition => 'inline',
Type => 'image/jpeg',
Encoding => 'base64',
Path => "840.jpg",
Filename => "840.jpg",
Id => "<840.jpg>"
);
$mime->attach(
Disposition => 'attachment',
Type => 'image/jpeg',
Encoding => 'base64',
Path => "840.jpg",
Filename => "840 attachment.jpg"
);
$mime->send('smtp',
$smtpserver,
Timeout=>60,
AuthUser=>$username,
AuthPass=>$password);
print $mime->as_string();
exit;