1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| #!/bin/perl
use MIME::Lite;
use Net::SMTP;
my $corps_mail = "H".chr(233)."llo";
# creation mail et envoi
# entete
$msg = new MIME::Lite
From =>'toto@toto.fr',
To =>'toto2@toto.fr',
Subject =>'mail html avec pièce jointe',
Type =>'multipart/mixed';
# creation du message
my $TXTMessage = new MIME::Lite
Type =>'TEXT',
Data =>$corps_mail;
# Modification du type (HTML)
$TXTMessage->attr("content-type" => "text/html; charset=iso-8859-1");
# Attachez le message au mail
$msg->attach ($TXTMessage);
# envoi
MIME::Lite->send("smtp", "smtp.free.fr", Timeout => 60);
$msg->send; |
Partager