Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision ced247a9

Von Martin Alpers vor 3 Tagen hinzugefügt

  • ID ced247a976e396d645ae73ae5321a9211fe9ee8d
  • Vorgänger 48fa6dcc
  • Nachfolger fa4bbc4f

added some better info in case of failed import of emails due to parsing problems

Unterschiede anzeigen:

SL/IMAPClient.pm
15 15
use Encode qw(encode decode);
16 16
use Encode::IMAPUTF7;
17 17
use SL::Locale;
18
use Try::Tiny;
18 19

  
19 20
use SL::SessionFile;
20 21
use SL::Locale::String qw(t8);
......
211 212
      next unless @new_msg_uids;
212 213

  
213 214
      $email_import ||= $self->_create_email_import(folder_path => $params{base_folder_path})->save();
214

  
215 215
      foreach my $new_uid (@new_msg_uids) {
216 216
        my $new_email_string = $self->{imap_client}->message_string($new_uid);
217
        my $email = Email::MIME->new($new_email_string);
218
        my $email_journal = $self->_create_email_journal(
219
          email                => $email,
220
          email_import         => $email_import,
221
          uid                  => $new_uid,
222
          folder_string        => $folder_string,
223
          folder_uidvalidity   => $folder_uidvalidity,
224
          email_journal_params => $params{email_journal_params},
225
        );
217
	my $email;
218
	try {
219
	  $email = Email::MIME->new($new_email_string);
220
	  my $email_journal = $self->_create_email_journal(
221
            email                => $email,
222
            email_import         => $email_import,
223
            uid                  => $new_uid,
224
            folder_string        => $folder_string,
225
            folder_uidvalidity   => $folder_uidvalidity,
226
            email_journal_params => $params{email_journal_params},
227
          );
226 228
        $email_journal->save();
229

  
230
        } catch {
231
	  my ($headers, $body) = split /\n\n/, $new_email_string;
232
	  my @subjects = grep {/^subject: +/i} (split /\n/, $headers);
233
	  die t8("Error while attempting to parse email.\nUID: #1\n#2\nError reported: #3", $new_uid, @subjects[0], $_)
234
	    unless $params{skip_broken_mime_mails};
235
        }
227 236
      }
228 237
    }
229 238
  });

Auch abrufbar als: Unified diff