Revision e900b0a7
Von Tamino Steinert vor mehr als 1 Jahr hinzugefügt
SL/BackgroundJob/SyncEmailInbox.pm | ||
---|---|---|
1 |
package SL::BackgroundJob::SyncEmailInbox; |
|
2 |
|
|
3 |
use strict; |
|
4 |
use warnings; |
|
5 |
|
|
6 |
use parent qw(SL::BackgroundJob::Base); |
|
7 |
|
|
8 |
use SL::IMAPClient; |
|
9 |
|
|
10 |
sub sync_email_inbox { |
|
11 |
my ($self) = @_; |
|
12 |
my $folder = $self->{job_obj}->data_as_hash->{folder} || 'INBOX'; |
|
13 |
|
|
14 |
my $imap_client = SL::IMAPClient->new(); |
|
15 |
|
|
16 |
$imap_client->update_emails_from_folder($folder); |
|
17 |
|
|
18 |
} |
|
19 |
|
|
20 |
sub run { |
|
21 |
my ($self, $job_obj) = @_; |
|
22 |
$self->{job_obj} = $job_obj; |
|
23 |
|
|
24 |
$self->sync_email_inbox(); |
|
25 |
|
|
26 |
return; |
|
27 |
} |
|
28 |
|
|
29 |
1; |
|
30 |
|
|
31 |
__END__ |
|
32 |
|
|
33 |
=encoding utf8 |
|
34 |
|
|
35 |
=head1 NAME |
|
36 |
|
|
37 |
SL::BackgroundJob::SyncEmailInbox - Background job for syncing emails from a folder |
|
38 |
|
|
39 |
=head1 SYNOPSIS |
|
40 |
|
|
41 |
This background job is used to sync emails from a folder. It can be used to sync |
|
42 |
emails from a folder on a regular basis for multiple folders. The folder to sync |
|
43 |
is specified in the data field 'folder' of the background job, by default the |
|
44 |
folder 'INBOX' is used. Sub folders are separated by a forward slash, |
|
45 |
e.g. 'INBOX/Archive'. Subfolders are not synced. |
|
46 |
|
|
47 |
=back |
|
48 |
|
|
49 |
=head1 BUGS |
|
50 |
|
|
51 |
Nothing here yet. |
|
52 |
|
|
53 |
=head1 AUTHOR |
|
54 |
|
|
55 |
Tamino Steinert E<lt>tamino.steinert@tamino.stE<gt> |
|
56 |
|
|
57 |
=cut |
Auch abrufbar als: Unified diff
Hintergrundjob um Emails aus einem Ordner zu synchronisieren