Bug 29501: Use the default transport
This patch makes the script pass the default SMTP transport to the ->send_or_die call. The default is picked as this is the current behavior. New enhancements could add the *library_id* to the message_queue table, and allow using different transports depending on that. But it is out of the scope of this bug. To test: 1. Verify messages are being sent. 2. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> JD amended patch: revert - unless $format =~ m[^html$|^csv$|^ods$]; + unless $format =~ m/^html$|^csv$|^ods$/; Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
parent
89ead8445e
commit
93a67add9f
|
|
@ -22,6 +22,7 @@ use C4::Log qw( cronlogaction );
|
|||
use Koha::DateUtils qw( dt_from_string output_pref );
|
||||
use Koha::Email;
|
||||
use Koha::Util::OpenDocument qw( generate_ods );
|
||||
use Koha::SMTP::Servers;
|
||||
|
||||
my (
|
||||
$help,
|
||||
|
|
@ -132,13 +133,19 @@ if ( @emails ) {
|
|||
csv => $csv_filenames,
|
||||
ods => $ods_filenames,
|
||||
};
|
||||
|
||||
my $transport = Koha::SMTP::Servers->get_default->transport;
|
||||
|
||||
for my $email ( @emails ) {
|
||||
send_files({
|
||||
directory => $output_directory,
|
||||
files => $files,
|
||||
to => $email,
|
||||
from => C4::Context->preference('KohaAdminEmailAddress'), # Should be replaced if bug 8000 is pushed
|
||||
});
|
||||
send_files(
|
||||
{
|
||||
directory => $output_directory,
|
||||
files => $files,
|
||||
from => C4::Context->preference('KohaAdminEmailAddress'), # Should be replaced if bug 8000 is pushed
|
||||
to => $email,
|
||||
transport => $transport,
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -282,10 +289,12 @@ sub _generate_ods {
|
|||
sub send_files {
|
||||
my ( $params ) = @_;
|
||||
my $directory = $params->{directory};
|
||||
my $files = $params->{files};
|
||||
my $to = $params->{to};
|
||||
my $from = $params->{from};
|
||||
return unless $to and $from;
|
||||
my $files = $params->{files};
|
||||
my $to = $params->{to};
|
||||
my $from = $params->{from};
|
||||
my $transport = $params->{transport};
|
||||
|
||||
return unless $to and $from and $transport;
|
||||
|
||||
my $email = Koha::Email->create(
|
||||
{
|
||||
|
|
@ -320,7 +329,8 @@ sub send_files {
|
|||
}
|
||||
}
|
||||
|
||||
$email->send_or_die;
|
||||
$email->send_or_die( { transport => $transport } );
|
||||
|
||||
}
|
||||
|
||||
=head1 NAME
|
||||
|
|
|
|||
Loading…
Reference in New Issue