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 30 31 32 33 34
| #!/usr/bin/perl
use strict;
use warnings;
use MIME::Lite;
my $message = "";
if (-s "info.txt" ) {
$message = "\n\nCi-dessous les info :\n\nBonne reception";
} else {
$message = "\n\nPas d'information !\n\nJoyeux Noël !";
}
my $msg = MIME::Lite->new(
From => 'xxxx@free.fr',
To => 'xxxx@yahoo.fr;xxxx@free.fr',
Subject => 'Fichier txt joint',
Type => 'TEXT',
Data => $message,
);
if (-e "info.xls" ) {
$msg->attach(
Type => "application/msexcel",
Id => 'info.xls',
Path => 'info.xls',
);
}
$msg->attach(
Type => "TEXT",
Id => 'info.txt',
Path => 'info.txt',
);
$msg->send('smtp','smtp.orange.fr', Debug=>0, Timeout => 5 ); |
Partager