Revision eb8e38d2
Von Moritz Bunkus vor etwa 12 Jahren hinzugefügt
SL/InstallationCheck.pm | ||
---|---|---|
41 | 41 |
{ name => "Net::LDAP", url => "http://search.cpan.org/~gbarr/", debian => 'libnet-ldap-perl' }, |
42 | 42 |
# Net::SMTP is core since 5.7.3 |
43 | 43 |
{ name => "Net::SMTP::SSL", version => '1.01', url => "http://search.cpan.org/~cwest/", debian => 'libnet-smtp-ssl-perl' }, |
44 |
{ name => "Net::SMTP::TLS", version => '0.12', url => "http://search.cpan.org/~awestholm/", debian => 'libnet-smtp-tls-perl' },
|
|
44 |
{ name => "Net::SSLGlue", version => '1.01', url => "http://search.cpan.org/~sullr/", debian => 'libnet-sslglue-perl' },
|
|
45 | 45 |
); |
46 | 46 |
|
47 | 47 |
@developer_modules = ( |
SL/Mailer/SMTP.pm | ||
---|---|---|
9 | 9 |
scalar => [ qw(myconfig mailer form) ] |
10 | 10 |
); |
11 | 11 |
|
12 |
my %security_config = ( |
|
13 |
none => { require_module => 'Net::SMTP', package => 'Net::SMTP', port => 25 }, |
|
14 |
tls => { require_module => 'Net::SSLGlue::SMTP', package => 'Net::SMTP', port => 25 }, |
|
15 |
ssl => { require_module => 'Net::SMTP::SSL', package => 'Net::SMTP::SSL', port => 465 }, |
|
16 |
); |
|
17 |
|
|
12 | 18 |
sub init { |
13 | 19 |
my ($self) = @_; |
14 | 20 |
|
15 | 21 |
Rose::Object::init(@_); |
16 | 22 |
|
17 | 23 |
my $cfg = $::lx_office_conf{mail_delivery} || {}; |
18 |
$self->{security} = lc($cfg->{security} || 'none'); |
|
19 |
|
|
20 |
if ($self->{security} eq 'tls') { |
|
21 |
require Net::SMTP::TLS; |
|
22 |
my %params; |
|
23 |
if ($cfg->{login}) { |
|
24 |
$params{User} = $cfg->{user}; |
|
25 |
$params{Password} = $cfg->{password}; |
|
26 |
} |
|
27 |
$self->{smtp} = Net::SMTP::TLS->new($cfg->{host} || 'localhost', Port => $cfg->{port} || 25, %params); |
|
28 |
|
|
29 |
} else { |
|
30 |
my $module = $self->{security} eq 'ssl' ? 'Net::SMTP::SSL' : 'Net::SMTP'; |
|
31 |
my $default_port = $self->{security} eq 'ssl' ? 465 : 25; |
|
32 |
eval "require $module" or die $@; |
|
33 |
|
|
34 |
$self->{smtp} = $module->new($cfg->{host} || 'localhost', Port => $cfg->{port} || $default_port); |
|
35 |
$self->{smtp}->auth($cfg->{user}, $cfg->{password}) if $cfg->{login}; |
|
36 |
} |
|
24 |
$self->{security} = exists $security_config{lc $cfg->{security}} ? lc $cfg->{security} : 'none'; |
|
25 |
my $sec_cfg = $security_config{ $self->{security} }; |
|
26 |
|
|
27 |
eval "require $sec_cfg->{require_module}" or die "$@"; |
|
37 | 28 |
|
29 |
$self->{smtp} = $sec_cfg->{package}->new($cfg->{host} || 'localhost', Port => $cfg->{port} || $sec_cfg->{port}); |
|
38 | 30 |
die unless $self->{smtp}; |
31 |
|
|
32 |
$self->{smtp}->starttls(SSL_verify_mode => 0) || die if $self->{security} eq 'tls'; |
|
33 |
|
|
34 |
return 1 unless $cfg->{login}; |
|
35 |
|
|
36 |
$self->{smtp}->auth($cfg->{user}, $cfg->{password}) or die; |
|
39 | 37 |
} |
40 | 38 |
|
41 | 39 |
sub start_mail { |
config/kivitendo.conf.default | ||
---|---|---|
115 | 115 |
method = smtp |
116 | 116 |
# Location of sendmail for 'method = sendmail' |
117 | 117 |
sendmail = /usr/sbin/sendmail -t<%if myconfig_email%> -f <%myconfig_email%><%end%> |
118 |
# Settings for 'method = smtp'. |
|
118 |
# Settings for 'method = smtp'. Only set 'port' if your SMTP server |
|
119 |
# runs on a non-standard port (25 for 'security=none' or |
|
120 |
# 'security=tls', 465 for 'security=ssl'). |
|
119 | 121 |
host = localhost |
120 |
port = 25 |
|
122 |
#port = 25
|
|
121 | 123 |
# Security can be 'tls', 'ssl' or 'none'. Unset equals 'none'. This |
122 | 124 |
# determines whether or not encryption is used and which kind. For |
123 |
# 'tls' the module 'Net::SMTP::TLS' is required; for 'ssl'
|
|
125 |
# 'tls' the module 'Net::SSLGlue' is required; for 'ssl'
|
|
124 | 126 |
# 'Net::SMTP::SSL' is required and 'none' only uses 'Net::SMTP'. |
125 | 127 |
security = none |
126 | 128 |
# Authentication is only used if 'login' is set. You should only use |
Auch abrufbar als: Unified diff
Net::SSLGlue anstelle von Net::SMTP::TLS verwenden
Net::SMTP::TLS enthält momentan einen unschönen Bug1, der mit
aktuellen Versionen von IO::Socket::SSL zusammen zu einer Exception
führt. Anscheinend wird Net::SMTP::TLS auch schon seit Jahren nicht
mehr gepflegt.
Net::SSLGlue::SMTP (Teil von Net::SSLGlue) erweitert dabei das
Net::SMTP-Interface um TLS-Befehle und ist damit zusätzlich näher am
Net::SMTP-Interface, als es Net::SMTP::TLS je war.
[1] https://rt.cpan.org/Public/Bug/Display.html?id=77401