summaryrefslogtreecommitdiffstats
path: root/perl-install/log.pm
Commit message (Expand)AuthorAgeFilesLines
* (explanations) redirect log where appropriate at install timeThierry Vignaud2004-09-061-1/+7
* use $LOG instead of *LOGPascal Rigaux2004-07-051-10/+10
* "je n'en veux + de cette engeance" (c) pixel :Thierry Vignaud2003-01-161-0/+2
* perl_checker adaptationsPascal Rigaux2002-11-271-1/+2
* - have "local *FILEHANDLE" before each "open FILEHANDLE, ..."Pascal Rigaux2002-11-061-3/+3
* s/__END__/1;Thierry Vignaud2002-08-051-1/+1
* kill "wonderful perl"Thierry Vignaud2002-08-051-4/+1
* make new perl_checker happy (and that's not easy!)Pascal Rigaux2002-07-311-4/+4
* when testing, log on STDERRPascal Rigaux2002-07-241-1/+3
* move /root/* files (ddebug.log, install.log, report.bug,Guillaume Cottenceau2002-01-291-1/+1
* - write the 'common' part of the 'explanations' stuff,Guillaume Cottenceau2002-01-181-4/+2
* no_commentPascal Rigaux2000-10-031-1/+1
* no_commentPascal Rigaux2000-09-221-2/+4
* no_commentPascal Rigaux2000-09-141-1/+1
* no_commentPascal Rigaux1999-12-091-11/+21
* no_commentPascal Rigaux1999-10-101-0/+1
* no_commentPascal Rigaux1999-09-191-2/+2
* no_commentPascal Rigaux1999-09-091-2/+2
* focus_outpad1999-09-051-1/+11
* pad stuffpad1999-09-031-1/+2
* no_commentPascal Rigaux1999-08-251-2/+2
* no_commentPascal Rigaux1999-07-311-1/+3
* no_commentPascal Rigaux1999-07-301-1/+1
* no_commentPascal Rigaux1999-07-291-2/+2
* "See_The_Changelog"Chmouel Boudjnah1999-07-011-0/+34
>-# share this with logdrake
sub send_mail {
my ($result) = @_;
- my $datem = `date`;
-
- local *F;
- open F, "|/usr/sbin/sendmail -f$user_mail $user_mail" or return 1;
- print F "From: drakbackup\n";
- print F "To: $user_mail \n";
- print F "Subject: DrakBackup report on $datem \n";
- print F "\n";
- print F "$result\n";
- close F or return 1;
- return 0;
+ my $datem = `date`;
+ use Mail::Mailer;
+ my $mailer = Mail::Mailer->new('smtp', Server => $smtp_server);
+ $mailer->open({ From => 'drakbackup',
+ To => $user_mail,
+ Subject => "DrakBackup report on $datem",
+ })
+ or return 1;
+ print $mailer $result;
+ $mailer->close;
+ 0;
}
sub build_backup_files() {
@@ -1472,7 +1487,7 @@ sub build_backup_files() {
if ($send_mail) {
if (send_mail($results)) {
- $interactive and $in->ask_warn(N("Error"), N("Error during sendmail. Your report mail was not sent. Please configure sendmail"));
+ $interactive and $in->ask_warn(N("Error"), N("Error sending mail. Your report mail was not sent."));
$interactive or print N(" Error while sending mail. \n");
}
}
@@ -2549,7 +2564,7 @@ sub combo_to_cron_string {
sub advanced_options() {
my $box_options;
-
+
gtkpack($advanced_box,
$box_options = gtkpack_(new Gtk2::VBox(0, 15),
0, my $check_tar_bz2 = new Gtk2::CheckButton(N("Use tar and bzip2 (rather than tar and gzip)")),
@@ -2557,7 +2572,13 @@ sub advanced_options() {
0, gtkpack_(new Gtk2::HBox(0,10),
0, my $check_mail = new Gtk2::CheckButton(N("Send mail report after each backup to:")),
1, new Gtk2::HBox(0,10),
- 0, my $mail_entry = new Gtk2::Entry(),
+ 0, gtkset_sensitive(my $mail_entry = new Gtk2::Entry(), $send_mail),
+ ),
+ 0, gtkpack_(new Gtk2::HBox(0,10),
+ 1, new Gtk2::HBox(0,10),
+ 0, N("SMTP server for mail:"),
+ 1, new Gtk2::HBox(0,10),
+ 0, gtkset_sensitive(my $smtp_entry = new Gtk2::Entry(), $send_mail),
),
0, gtkpack_(new Gtk2::HBox(0,10),
0, my $check_del_hd_files = new Gtk2::CheckButton(N("Delete Hard Drive tar files after backup to other media.")),
@@ -2567,6 +2588,8 @@ sub advanced_options() {
check_list([$check_mail, \$send_mail], [$check_tar_bz2, \$comp_mode], [$check_del_hd_files, \$del_hd_files], [$check_backupignore, \$backupignore]);
$mail_entry->set_text($user_mail);
$mail_entry->signal_connect('changed', sub { $user_mail = $mail_entry->get_text });
+ $smtp_entry->set_text($smtp_server);
+ $smtp_entry->signal_connect('changed', sub { $smtp_server = $smtp_entry->get_text });
set_help_tip($check_backupignore, 'backupignore');
set_help_tip($check_mail, 'send_mail_to');
set_help_tip($check_del_hd_files, 'delete_files');
@@ -2890,7 +2913,8 @@ sub system_state() {
}
$system_state .= N("\tUse .backupignore files\n") if $backupignore;
- $system_state .= N("\tSend mail to %s\n", $user_mail) if $user_mail;
+ $system_state .= N("\tSend mail to %s\n", $user_mail) if $send_mail;
+ $system_state .= N("\tUsing SMTP server %s\n", $smtp_server) if $send_mail;
$daemon_media and $system_state .= N("\n- Daemon, %s via:\n", $when_space);
$daemon_media eq 'hd' and $system_state .= N("\t-Hard drive.\n");