Revision 77cb45b9
| SL/BackgroundJob/ImportRecordEmails.pm | ||
|---|---|---|
|
record_type => $config->{record_type},
|
||
|
},
|
||
|
skip_broken_mime_mails => $config->{skip_broken_mime_mails},
|
||
|
not_imported_imap_flag => $config->{not_imported_imap_flag},
|
||
|
);
|
||
|
return "No emails to import." unless $email_import;
|
||
|
if ($config->{imported_imap_flag}) {
|
||
| ... | ... | |
|
not_processed_imap_flag => { type => SCALAR, optional => 1, },
|
||
|
email_import_ids_to_delete => { type => ARRAYREF, optional => 1, },
|
||
|
imported_imap_flag => { type => SCALAR, optional => 1, },
|
||
|
not_imported_imap_flag => { type => SCALAR, optional => 1, },
|
||
|
skip_broken_mime_mails => { type => SCALAR, optional => 1, },
|
||
|
# email config
|
||
|
hostname => { type => SCALAR, },
|
||
| SL/IMAPClient.pm | ||
|---|---|---|
|
type => SCALAR | UNDEF,
|
||
|
optional => 1,
|
||
|
},
|
||
|
not_imported_imap_flag => {
|
||
|
type => SCALAR | UNDEF,
|
||
|
optional => 1,
|
||
|
},
|
||
|
});
|
||
|
my $folder_path = $params{folder} || $self->{base_folder};
|
||
|
|
||
| ... | ... | |
|
folder_strings => [$folder_string],
|
||
|
email_journal_params => $params{email_journal_params},
|
||
|
skip_broken_mime_mails => $params{skip_broken_mime_mails},
|
||
|
not_imported_imap_flag => $params{not_imported_imap_flag},
|
||
|
);
|
||
|
|
||
|
return $email_import;
|
||
| ... | ... | |
|
type => SCALAR | UNDEF,
|
||
|
optional => 1,
|
||
|
},
|
||
|
not_imported_imap_flag => {
|
||
|
type => SCALAR | UNDEF,
|
||
|
optional => 1,
|
||
|
},
|
||
|
|
||
|
});
|
||
|
my $dbh = SL::DB->client->dbh;
|
||
|
|
||
| ... | ... | |
|
);
|
||
|
$email_journal->save();
|
||
|
} catch {
|
||
|
my ($headers, $body) = split /\n\n/, $new_email_string;
|
||
|
my @subjects = grep {/^subject: +/i} (split /\n/, $headers);
|
||
|
die t8("Error while attempting to parse email.\nUID: #1\n#2\nError reported: #3", $new_uid, @subjects[0], $_)
|
||
|
unless $params{skip_broken_mime_mails};
|
||
|
|
||
|
$self->{imap_client}->set_flag($params{not_imported_imap_flag}, [$new_uid])
|
||
|
if $params{not_imported_imap_flag};
|
||
|
|
||
|
my ($headers, $body) = split /\n\n/, $new_email_string;
|
||
|
my @subjects = grep {/^subject: +/i} (split /\n/, $headers);
|
||
|
|
||
|
die t8("Error while attempting to parse email.\nUID: '#1'\n'#2'\nError reported: '#3'", $new_uid, @subjects[0], $_)
|
||
|
unless $params{skip_broken_mime_mails};
|
||
|
}
|
||
|
}
|
||
|
}
|
||
Auch abrufbar als: Unified diff
BJ IRE Neues Imap-Flag falls E-Mail nicht geparst werden kann