Bug 3810: Ensure all calls to Mail::Sendmail handled consistently
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com> Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
This commit is contained in:
parent
784b9df4f2
commit
cf28bf4785
7 changed files with 20 additions and 15 deletions
|
@ -20,6 +20,7 @@ use warnings;
|
||||||
|
|
||||||
use CGI;
|
use CGI;
|
||||||
use Encode qw(encode);
|
use Encode qw(encode);
|
||||||
|
use Carp;
|
||||||
|
|
||||||
use Mail::Sendmail;
|
use Mail::Sendmail;
|
||||||
use MIME::QuotedPrint;
|
use MIME::QuotedPrint;
|
||||||
|
@ -164,7 +165,7 @@ END_OF_BODY
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
# do something if it doesnt work....
|
# do something if it doesnt work....
|
||||||
warn "Error sending mail: $Mail::Sendmail::error \n";
|
carp "Error sending mail: $Mail::Sendmail::error \n";
|
||||||
$template->param( error => 1 );
|
$template->param( error => 1 );
|
||||||
}
|
}
|
||||||
$template->param( email_add => $email_add );
|
$template->param( email_add => $email_add );
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
use strict;
|
use strict;
|
||||||
#use warnings; FIXME - Bug 2505
|
#use warnings; FIXME - Bug 2505
|
||||||
|
use Carp;
|
||||||
BEGIN {
|
BEGIN {
|
||||||
# find Koha's Perl modules
|
# find Koha's Perl modules
|
||||||
# test carefully before changing this
|
# test carefully before changing this
|
||||||
|
@ -201,12 +202,12 @@ foreach my $num (@getnofifys) {
|
||||||
'content-type' => 'text/html; charset="utf-8"',
|
'content-type' => 'text/html; charset="utf-8"',
|
||||||
);
|
);
|
||||||
# if we don't have any content for the mail, we don't launch mail, but notify it in a file
|
# if we don't have any content for the mail, we don't launch mail, but notify it in a file
|
||||||
if ($mailtext ne 'nonotifys') {
|
if ($mailtext ne 'nonotifys') {
|
||||||
sendmail(%mail);
|
sendmail(%mail) or carp $Mail::Sendmail::error;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
print OUT $email ;
|
print OUT $email ;
|
||||||
}
|
}
|
||||||
|
|
||||||
# now deal with the debarred mode
|
# now deal with the debarred mode
|
||||||
# if ($debarred eq 1) {
|
# if ($debarred eq 1) {
|
||||||
|
|
|
@ -28,6 +28,7 @@ use Pod::Usage;
|
||||||
use Mail::Sendmail;
|
use Mail::Sendmail;
|
||||||
use Text::CSV_XS;
|
use Text::CSV_XS;
|
||||||
use CGI;
|
use CGI;
|
||||||
|
use Carp;
|
||||||
|
|
||||||
use vars qw($VERSION);
|
use vars qw($VERSION);
|
||||||
|
|
||||||
|
@ -159,7 +160,7 @@ unless (scalar(@ARGV)) {
|
||||||
foreach my $report (@ARGV) {
|
foreach my $report (@ARGV) {
|
||||||
my ($sql, $type) = get_saved_report($report);
|
my ($sql, $type) = get_saved_report($report);
|
||||||
unless ($sql) {
|
unless ($sql) {
|
||||||
warn "ERROR: No saved report $report found";
|
carp "ERROR: No saved report $report found";
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
$verbose and print "SQL: $sql\n\n";
|
$verbose and print "SQL: $sql\n\n";
|
||||||
|
@ -188,7 +189,7 @@ foreach my $report (@ARGV) {
|
||||||
Subject => $subject,
|
Subject => $subject,
|
||||||
Message => $message
|
Message => $message
|
||||||
);
|
);
|
||||||
sendmail(%mail) or warn "mail not sent";
|
sendmail(%mail) or carp 'mail not sent:' . $Mail::Sendmail::error;
|
||||||
} else {
|
} else {
|
||||||
print $message;
|
print $message;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,13 +40,13 @@ BEGIN {
|
||||||
use C4::Context;
|
use C4::Context;
|
||||||
use C4::Search;
|
use C4::Search;
|
||||||
use C4::Circulation;
|
use C4::Circulation;
|
||||||
use C4::Circulation::Fines;
|
|
||||||
use C4::Members;
|
use C4::Members;
|
||||||
use C4::Dates qw/format_date/;
|
use C4::Dates qw/format_date/;
|
||||||
use HTML::Template::Pro;
|
use HTML::Template::Pro;
|
||||||
use Mail::Sendmail;
|
use Mail::Sendmail;
|
||||||
use Mail::RFC822::Address;
|
use Mail::RFC822::Address;
|
||||||
use C4::SMS;
|
use C4::SMS;
|
||||||
|
use Carp;
|
||||||
use utf8;
|
use utf8;
|
||||||
my ($res,$ua);##variables for SMS
|
my ($res,$ua);##variables for SMS
|
||||||
|
|
||||||
|
@ -312,8 +312,7 @@ sub sendEmail {
|
||||||
|
|
||||||
|
|
||||||
if (not(sendmail %mail)) {
|
if (not(sendmail %mail)) {
|
||||||
warn $Mail::Sendmail::error;
|
carp "sendEmail to $to failed: " . $Mail::Sendmail::error;
|
||||||
warn "sendEmail to $to failed.";
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ use warnings;
|
||||||
|
|
||||||
use CGI;
|
use CGI;
|
||||||
use Encode qw(encode);
|
use Encode qw(encode);
|
||||||
|
use Carp;
|
||||||
|
|
||||||
use Mail::Sendmail;
|
use Mail::Sendmail;
|
||||||
use MIME::QuotedPrint;
|
use MIME::QuotedPrint;
|
||||||
|
@ -170,7 +171,7 @@ END_OF_BODY
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
# do something if it doesnt work....
|
# do something if it doesnt work....
|
||||||
warn "Error sending mail: $Mail::Sendmail::error \n";
|
carp "Error sending mail: $Mail::Sendmail::error \n";
|
||||||
$template->param( error => 1 );
|
$template->param( error => 1 );
|
||||||
}
|
}
|
||||||
$template->param( email_add => $email_add );
|
$template->param( email_add => $email_add );
|
||||||
|
|
|
@ -22,6 +22,7 @@ use warnings;
|
||||||
|
|
||||||
use CGI;
|
use CGI;
|
||||||
use Encode qw(encode);
|
use Encode qw(encode);
|
||||||
|
use Carp;
|
||||||
|
|
||||||
use Mail::Sendmail;
|
use Mail::Sendmail;
|
||||||
use MIME::QuotedPrint;
|
use MIME::QuotedPrint;
|
||||||
|
@ -162,7 +163,7 @@ END_OF_BODY
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
# do something if it doesnt work....
|
# do something if it doesnt work....
|
||||||
warn "Error sending mail: $Mail::Sendmail::error \n";
|
carp "Error sending mail: $Mail::Sendmail::error \n";
|
||||||
$template->param( error => 1 );
|
$template->param( error => 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ use warnings;
|
||||||
|
|
||||||
use CGI;
|
use CGI;
|
||||||
use Encode qw(encode);
|
use Encode qw(encode);
|
||||||
|
use Carp;
|
||||||
|
|
||||||
use Mail::Sendmail;
|
use Mail::Sendmail;
|
||||||
use MIME::QuotedPrint;
|
use MIME::QuotedPrint;
|
||||||
|
@ -157,7 +158,7 @@ END_OF_BODY
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
# do something if it doesnt work....
|
# do something if it doesnt work....
|
||||||
warn "Error sending mail: $Mail::Sendmail::error \n";
|
carp "Error sending mail: $Mail::Sendmail::error \n";
|
||||||
$template->param( error => 1 );
|
$template->param( error => 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue