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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
#
#FUNCTIONS
#
sub envoiMail{
my ($destinataire, @attachments) = @_;
#my $destinataire = $_[0]; #param 1
#my @attachments = @_[1]; #param 2
#print "$data1\n";
#print "***$data2***\n";
my @parts = ();
#CONFIGURATION SMTP
my $transport = Email::Sender::Transport::SMTP->new(
host=>'***************',
port=>'25',
username=>'*******************',
password=>'*********',
);
#ATTACHMENTS
foreach my $attachment (@attachments){
my @splitExtension = split(/./,$attachment);
my @splitNomFichier = split(/\\/,$attachment);
#my $nomFichier = @splitNomFichier[2];
#my $extension = @splitExtension[1];
#print "### $attachment ###\n";
my $attachment_object = Email::MIME->create(
attributes => {
filename => "test",
content_type => "application/pdf",
encoding => "base64",
disposition => "attachment",
name => "test.pdf",
},
body => io($attachment)->all,
);
@parts = ($attachment_object);
} |
Partager