Skip to content

Commit 5f9687e

Browse files
committed
permesu agordi SMTP-retpordon
1 parent 42cb29a commit 5f9687e

File tree

3 files changed

+93
-90
lines changed

3 files changed

+93
-90
lines changed

bin/mailsender.pm

+2
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ sub smtp_connect {
5252
#print "SASL: ",Dumper($sasl) if ($debug);
5353
return $smtps;
5454
}
55+
} else {
56+
die "Agordo por retpoŝt-sendo mankas!";
5557
}
5658
}
5759

bin/processmail.pl

+89-89
Original file line numberDiff line numberDiff line change
@@ -622,105 +622,105 @@ sub send_reports {
622622

623623
# legu la respondojn el $mail_send
624624
if (-e $mail_send) {
625-
626-
$/ = $separator;
627-
unless (open SMAIL, $mail_send) {
628-
warn "Ne povis malfermi $mail_send: $!\n";
629-
return;
630-
}
625+
626+
$/ = $separator;
627+
unless (open SMAIL, $mail_send) {
628+
warn "Ne povis malfermi $mail_send: $!\n";
629+
return;
630+
}
631631

632-
while (<SMAIL>) {
633-
# elprenu la sendinton
634-
if (s/^sendinto: *([^\n]+)\n//) {
635-
$mail_addr = $1;
636-
# chu dosierojn sendu?
637-
if (s/^dosieroj: *([^\n\s]+)\n//) {
638-
$dos = $1;
639-
if ($_ =~ /artikolo: *([^\n]+)\n/s) { $art_id = $1; }
640-
# foje jam malaperis la aldonenda dosiero pro antaŭa eraro, kio kaŭzus
641-
# senfinan sendadon de ĉiam la sama eraro..., do aldonu nur se la dosiero ekzistas
642-
if (-e $dos) {
643-
$dosieroj{$mail_addr} .= "$dos $art_id|";
632+
while (<SMAIL>) {
633+
# elprenu la sendinton
634+
if (s/^sendinto: *([^\n]+)\n//) {
635+
$mail_addr = $1;
636+
# chu dosierojn sendu?
637+
if (s/^dosieroj: *([^\n\s]+)\n//) {
638+
$dos = $1;
639+
if ($_ =~ /artikolo: *([^\n]+)\n/s) { $art_id = $1; }
640+
# foje jam malaperis la aldonenda dosiero pro antaŭa eraro, kio kaŭzus
641+
# senfinan sendadon de ĉiam la sama eraro..., do aldonu nur se la dosiero ekzistas
642+
if (-e $dos) {
643+
$dosieroj{$mail_addr} .= "$dos $art_id|";
644+
}
644645
}
646+
$reports{$mail_addr} .= $_;
647+
} else {
648+
warn "Ne povis elpreni sendinton el $_\n";
649+
next;
645650
}
646-
$reports{$mail_addr} .= $_;
647-
} else {
648-
warn "Ne povis elpreni sendinton el $_\n";
649-
next;
650-
}
651-
}
652-
close SMAIL;
653-
$/ = $newline;
654-
655-
# forsendu la raportojn
656-
while (($mail_addr,$message) = each %reports) {
657-
$dos = $dosieroj{$mail_addr};
658-
$mail_addr =~ s/.*<([a-z0-9\.\_\-@]+)>.*/$1/;
659-
660-
# preparu mesaghon
661-
$message = "Saluton!\n"
662-
."Jen raporto pri via(j) sendita(j) artikolo(j).\n\n"
663-
.$separator.$message."\n".$signature;
664-
665-
$mail_handle = build MIME::Entity(Type=>"multipart/mixed",
666-
From=>$revo_from,
667-
To=>"$mail_addr",
668-
Subject=>"$revoservo - raporto");
669-
670-
print "AL: <$mail_addr>: [[[\n$message\n]]]\n" if ($verbose);
671-
672-
$mail_handle->attach(Type=>"text/plain",
673-
Encoding=>"quoted-printable",
674-
Data=>$message);
675-
676-
# alpendigu dosierojn
677-
if ($dos) {
678-
for $file (split (/\|/,$dos)) {
679-
if ($file =~ /^\s*([^\s]+)\s+(.+?)\s*$/) {
680-
$file = $1;
681-
$art_id = $2;
682-
683-
if ($art_id =~ /^\044([^\044]+)\044$/) {
684-
$art_id = $1;
685-
$art_id =~ /^Id: ([^ ,\.]+\.xml),v/;
686-
$marko = $1;
687-
} else {
688-
$marko=$art_id;
651+
}
652+
close SMAIL;
653+
$/ = $newline;
654+
655+
# forsendu la raportojn
656+
while (($mail_addr,$message) = each %reports) {
657+
$dos = $dosieroj{$mail_addr};
658+
$mail_addr =~ s/.*<([a-z0-9\.\_\-@]+)>.*/$1/;
659+
660+
# preparu mesaghon
661+
$message = "Saluton!\n"
662+
."Jen raporto pri via(j) sendita(j) artikolo(j).\n\n"
663+
.$separator.$message."\n".$signature;
664+
665+
$mail_handle = build MIME::Entity(Type=>"multipart/mixed",
666+
From=>$revo_from,
667+
To=>"$mail_addr",
668+
Subject=>"$revoservo - raporto");
669+
670+
print "AL: <$mail_addr>: [[[\n$message\n]]]\n" if ($verbose);
671+
672+
$mail_handle->attach(Type=>"text/plain",
673+
Encoding=>"quoted-printable",
674+
Data=>$message);
675+
676+
# alpendigu dosierojn
677+
if ($dos) {
678+
for $file (split (/\|/,$dos)) {
679+
if ($file =~ /^\s*([^\s]+)\s+(.+?)\s*$/) {
680+
$file = $1;
681+
$art_id = $2;
682+
683+
if ($art_id =~ /^\044([^\044]+)\044$/) {
684+
$art_id = $1;
685+
$art_id =~ /^Id: ([^ ,\.]+\.xml),v/;
686+
$marko = $1;
687+
} else {
688+
$marko=$art_id;
689+
}
690+
} else { $art_id = $file; $marko=$file; }
691+
692+
print "attach: $file\n" if ($debug);
693+
if (-e $file) {
694+
$mail_handle->attach(Path=>$file,
695+
Type=>'text/plain',
696+
Encoding=>'quoted-printable',
697+
Disposition=>'attachment',
698+
Filename=>$marko,
699+
Description=>$art_id);
689700
}
690-
} else { $art_id = $file; $marko=$file; }
691-
692-
print "attach: $file\n" if ($debug);
693-
if (-e $file) {
694-
$mail_handle->attach(Path=>$file,
695-
Type=>'text/plain',
696-
Encoding=>'quoted-printable',
697-
Disposition=>'attachment',
698-
Filename=>$marko,
699-
Description=>$art_id);
700701
}
701702
}
702-
}
703-
704-
# forsendu
705-
print "sendi nun...\n" if ($verbose);
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");
716-
next;
717-
}
703+
704+
# forsendu
705+
print "sendi nun...\n" if ($verbose);
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");
716+
next;
717+
}
718718

719-
}
719+
} # while
720720

721721
# forigu $mail_send
722722
# unlink($mail_send);
723-
}
723+
} # if
724724
}
725725

726726

bin/setup_smtp.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ if [[ -z "$SMTP_PASSWORD" ]]; then
1919
fi
2020

2121
# 25 neĉifrita, ĉifritaj pordoj 465 aŭ 587
22-
SMTP_PORT=587
22+
#SMTP_PORT=587
23+
: ${SMTP_PORT:=587}
2324

2425
cat <<EOC > ${mailsenderconf}
2526
{

0 commit comments

Comments
 (0)