Revision c4baf68a
Von Tamino Steinert vor mehr als 1 Jahr hinzugefügt
SL/Mailer.pm | ||
---|---|---|
337 | 337 |
my $config = $::lx_office_conf{sent_emails_in_imap} || {}; |
338 | 338 |
return unless ($config->{enabled} && $config->{hostname}); |
339 | 339 |
|
340 |
my $socket; |
|
341 |
if ($config->{ssl}) { |
|
342 |
$socket = IO::Socket::SSL->new( |
|
343 |
Proto => 'tcp', |
|
344 |
PeerAddr => $config->{hostname}, |
|
345 |
PeerPort => $config->{port} || 993, |
|
346 |
); |
|
347 |
} else { |
|
348 |
$socket = IO::Socket::INET->new( |
|
349 |
Proto => 'tcp', |
|
350 |
PeerAddr => $config->{hostname}, |
|
351 |
PeerPort => $config->{port} || 143, |
|
352 |
); |
|
353 |
} |
|
354 |
if (!$socket) { |
|
355 |
die "Failed to create socket for IMAP client: $@\n"; |
|
356 |
} |
|
357 |
|
|
358 |
# TODO: get email and password for each user |
|
359 | 340 |
my $imap = Mail::IMAPClient->new( |
360 |
Socket => $socket,
|
|
341 |
Server => $config->{hostname},
|
|
361 | 342 |
User => $config->{username}, |
362 | 343 |
Password => $config->{password}, |
344 |
Port => $config->{port}, |
|
345 |
Ssl => $config->{ssl}, |
|
363 | 346 |
) or do { |
364 | 347 |
die "Failed to create IMAP Client: $@\n" |
365 | 348 |
}; |
Auch abrufbar als: Unified diff
IMAPClient direkt erstellen (ohne separaten Socket)