From 3ab8661fbfc697f575d2a74226ac6ba8f4dabeb6 Mon Sep 17 00:00:00 2001 From: Mercier Pierre-Olivier Date: Thu, 19 Sep 2013 20:57:47 +0200 Subject: [PATCH] No more use Email::Sender::Simple --- utils/lpt | 50 ++++++++++++++++---------------------------------- 1 file changed, 16 insertions(+), 34 deletions(-) diff --git a/utils/lpt b/utils/lpt index c5309ab..d55864c 100755 --- a/utils/lpt +++ b/utils/lpt @@ -12,7 +12,6 @@ use Net::LDAP::Util qw(ldap_error_text); use Pod::Usage; use Term::ANSIColor qw(:constants); use Term::ReadKey; -use Quota; #use Cwd 'abs_path'; #use File::Basename; @@ -1403,7 +1402,8 @@ sub cmd_ssh_keys_without_passphrase_warn(@) print $entry->get_value("uid")."\n"; # create the message - use Email::MIME; + use Mail::Internet; + my $body = "Bonjour ".$entry->get_value("cn").", Un outil automatique a découvert une clé sans passphrase sur votre compte @@ -1429,23 +1429,14 @@ PS: Ce message est g -- Les roots ACU"; - my $message = Email::MIME->create( - header_str => [ - From => 'root@acu.epita.fr', - To => $entry->get_value("mailAlias"), - Cc => 'root@acu.epita.fr', - Subject => '[LAB][SSH-PASSPHRASE] Clef SSH non protégée', - ], - attributes => { - encoding => 'quoted-printable', - charset => 'UTF-8', - }, - body_str => $body, - ); - # send the message - use Email::Sender::Simple qw(sendmail); - sendmail($message); + my $email = Mail::Internet->new(); + $email->body($body); + $email->add( "To", $entry->get_value("mailAlias") ); + $email->add( "Cc", "" ); + $email->add( "From", "Roots assistants " ); + $email->add( "Subject", "[LAB][SSH-PASSPHRASE] Clef SSH non protégée" ); + $email->send(); }; cmd_ssh_keys_without_passphrase_generic(\&$process); @@ -1494,23 +1485,14 @@ PS: Ce message est g -- Les roots ACU"; - my $message = Email::MIME->create( - header_str => [ - From => 'root@acu.epita.fr', - To => $entry->get_value("aliasmail"), - Cc => 'root@acu.epita.fr', - Subject => '[LAB][SSH-PASSPHRASE] Clé SSH non protégée supprimée', - ], - attributes => { - encoding => 'quoted-printable', - charset => 'UTF-8', - }, - body_str => $body, - ); - # send the message - use Email::Sender::Simple qw(sendmail); - sendmail($message); + my $email = Mail::Internet->new(); + $email->body($body); + $email->add( "To", $entry->get_value("mailAlias") ); + $email->add( "Cc", "" ); + $email->add( "From", "Roots assistants " ); + $email->add( "Subject", "[LAB][SSH-PASSPHRASE] Clef SSH non protégée supprimée" ); + $email->send(); }; cmd_ssh_keys_without_passphrase_generic(\&$process);