1 package Koha::SMTP::Servers;
3 # This file is part of Koha.
5 # Koha is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # Koha is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with Koha; if not, see <http://www.gnu.org/licenses>.
23 use Koha::SMTP::Server;
25 use base qw(Koha::Objects);
29 Koha::SMTP::Servers - Koha SMTP Server Object set class
37 my $server = Koha::SMTP::Servers->new->get_default;
39 Returns the default I<Koha::SMTP::Server> object.
48 my $smtp_config = C4::Context->config('smtp_server');
50 if ( $default = $self->search({ is_default => 1 }, { rows => 1 })->single ) {
53 elsif ( $smtp_config ) {
54 $default = Koha::SMTP::Server->new( $smtp_config );
57 $default = Koha::SMTP::Server->new( $self->default_setting );
60 $default->{_is_system_default} = 1;
64 =head2 Internal methods
68 Return type of object, relating to Schema ResultSet
76 =head3 default_setting
78 my $hash = Koha::SMTP::Servers::default_setting;
80 Returns the default setting that is to be used when no user-defined default
81 SMTP server is provided
91 ssl_mode => 'disabled',
105 return 'Koha::SMTP::Server';