Skip to content

Commit 42cb29a

Browse files
committedNov 15, 2024·
uzu mailsender.pm anst. postfix sendmail
1 parent 509b17e commit 42cb29a

File tree

1 file changed

+42
-14
lines changed

1 file changed

+42
-14
lines changed
 

‎bin/processmail.pl

+42-14
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@
1111
use lib("/usr/local/bin");
1212
use lib("./bin");
1313
use process qw (trim);
14+
use mailsender;
1415

1516
use MIME::Parser;
1617
use MIME::Entity;
1718

19+
1820
######################### agorda parto ##################
1921

2022
# kiom da informoj
@@ -49,9 +51,9 @@
4951
#$xmlcheck = '/usr/bin/rxp -V -s';
5052
$git = '/usr/bin/git';
5153
# -t ne subtenata de ssmtp
52-
#$sendmail = '/usr/lib/sendmail -t -i';
5354
$rsync = '/usr/bin/rsync -rv';
54-
$sendmail = '/usr/lib/sendmail -i';
55+
#$sendmail = '/usr/lib/sendmail -t -i';
56+
#$sendmail = '/usr/lib/sendmail -i';
5557
#$patch = '/usr/bin/patch';
5658

5759
# dosierujoj
@@ -175,7 +177,15 @@
175177

176178
# sendu raportojn
177179
print "elsendas raportojn...\n" if ($verbose);
178-
send_reports();
180+
181+
#send_reports();
182+
183+
if (-s $mail_send > 10) {
184+
my $mailer = mailsender::smtp_connect;
185+
send_reports($mailer);
186+
mailsender::smtp_quit($mailer);
187+
}
188+
179189

180190
##send_newarts_report();
181191
print "puŝas ŝanĝojn al git...\n" if ($verbose);
@@ -603,6 +613,8 @@ sub report {
603613
}
604614

605615
sub send_reports {
616+
my $mailer = shift;
617+
606618
my $newline = $/;
607619
my %reports = ();
608620
my %dosieroj = ();
@@ -691,12 +703,19 @@ sub send_reports {
691703

692704
# forsendu
693705
print "sendi nun...\n" if ($verbose);
694-
unless (open SENDMAIL, "| $sendmail '$mail_addr'") {
695-
warn "Ne povas dukti al $sendmail: $!\n";
706+
## unless (open SENDMAIL, "| $sendmail '$mail_addr'") {
707+
## warn "Ne povas dukti al $sendmail: $!\n";
708+
## next;
709+
## }
710+
## $mail_handle->print(\*SENDMAIL);
711+
## close SENDMAIL;
712+
713+
# forsendu
714+
unless (mailsender::smtp_send($mailer,$revo_from,$mail_addr,$mail_handle)) {
715+
$log->warn("Ne povas forsendi retpoŝtan raporton!\n");
696716
next;
697-
}
698-
$mail_handle->print(\*SENDMAIL);
699-
close SENDMAIL;
717+
}
718+
700719
}
701720

702721
# forigu $mail_send
@@ -730,13 +749,22 @@ sub cmd_help {
730749
Filename=>"$dok_dir/helpo.txt",
731750
Description=>"helpo pri Revo-servo");
732751

733-
# forsendu
734-
unless (open SENDMAIL, "|$sendmail $mail_addr") {
735-
warn "Ne povas dukti al $sendmail: $!\n";
752+
# forsendu
753+
# unless (open SENDMAIL, "|$sendmail $mail_addr") {
754+
# warn "Ne povas dukti al $sendmail: $!\n";
755+
# return;
756+
# }
757+
# $mail_handle->print(\*SENDMAIL);
758+
# close SENDMAIL;
759+
760+
# forsendu
761+
my $mailer = mailsender::smtp_connect;
762+
unless (mailsender::smtp_send($mailer,$revo_from,$mail_addr,$mail_handle)) {
763+
$log->warn("Ne povas forsendi retpoŝtan raporton!\n");
736764
return;
737-
}
738-
$mail_handle->print(\*SENDMAIL);
739-
close SENDMAIL;
765+
}
766+
mailsender::smtp_quit($mailer);
767+
740768
}
741769

742770

0 commit comments

Comments
 (0)
Please sign in to comment.