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
  });
locale/de/all
1584 1584
  'Error message from the webshop api:' => 'Fehlermeldung der Webshop Api',
1585 1585
  'Error when saving: #1'       => 'Fehler beim Speichern: #1',
1586 1586
  'Error while applying year-end bookings!' => 'Fehler beim Durchführen der Abschlußbuchungen!',
1587
  'Error while attempting to parse email.\nUID: #1\n#2\nError reported: #3' => 'Fehler beim Parsen folgender E-Mail.\nUID: #1\n#2\nFehlermeldung: #3',
1587 1588
  'Error while creating project with project number of new order number, project number #1 already exists!' => 'Fehler beim Erstellen eines Projekts mit der Projektnummer der neuen Auftragsnummer, Projektnummer #1 existiert bereits!',
1588 1589
  'Error while processing email journal (\'#1\') attachments with \'#2\': ' => 'Fehler beim Verarbeiten der E-Mail-Journals (\'#1\') Anhänge mit \'#2\': ',
1589 1590
  'Error while saving shop order #1. DB Error #2. Generic exception #3.' => 'Fehler beim Speichern der Shop-Bestellung #1. DB Fehler #2. Genereller Fehler #3.',
locale/en/all
1584 1584
  'Error message from the webshop api:' => '',
1585 1585
  'Error when saving: #1'       => '',
1586 1586
  'Error while applying year-end bookings!' => '',
1587
  'Error while attempting to parse email.\nUID: #1\n#2\nError reported: #3' => '',
1587 1588
  'Error while creating project with project number of new order number, project number #1 already exists!' => '',
1588 1589
  'Error while processing email journal (\'#1\') attachments with \'#2\': ' => '',
1589 1590
  'Error while saving shop order #1. DB Error #2. Generic exception #3.' => '',

Auch abrufbar als: Unified diff