Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 2bceb436

Von Sven Schöling vor mehr als 3 Jahren hinzugefügt

  • ID 2bceb436f4f68179d8b380f75331b15d2ebe5737
  • Vorgänger 00a6bdd7
  • Nachfolger 63ff5020

Mailer: Bei fehlerhaften Mailadressen warnen

(cherry picked from commit e8f152b186583bc254ff631f4803189da4f3013e)
(cherry-pick von odyn)

Unterschiede anzeigen:

SL/Mailer.pm
29 29
use File::MimeInfo::Magic;
30 30
use File::Slurp;
31 31
use List::UtilsBy qw(bundle_by);
32
use List::Util qw(sum);
32 33

  
33 34
use SL::Common;
34 35
use SL::DB::EmailJournal;
35 36
use SL::DB::EmailJournalAttachment;
36 37
use SL::DB::Employee;
38
use SL::Locale::String qw(t8);
37 39
use SL::Template;
38 40
use SL::Version;
39 41

  
......
121 123
    next if !$self->{$item};
122 124

  
123 125
    my @header_addresses;
126
    my @addresses = Email::Address->parse($self->{$item});
127

  
128
    # if either no address was parsed or
129
    # there are more than 3 characters per parsed email extra, assume the the user has entered bunk
130
    if (!@addresses) {
131
       die t8('"#1" seems to be a faulty list of email addresses. No addresses could be extracted.',
132
         $self->{$item},
133
       );
134
    } elsif ((length($self->{$item}) - sum map { length $_->original } @addresses) / @addresses > 3) {
135
       die t8('"#1" seems to be a faulty list of email addresses. After extracing addresses (#2) too many characters are left.',
136
         $self->{$item}, join ', ', map { $_->original } @addresses,
137
       );
138
    }
124 139

  
125
    foreach my $addr_obj (Email::Address->parse($self->{$item})) {
140
    foreach my $addr_obj (@addresses) {
126 141
      push @{ $self->{addresses}->{$item} }, $addr_obj->address;
127 142
      next if $self->{driver}->keep_from_header($item);
128 143

  
locale/de/all
13 13
  ' Date missing!'              => ' Datum fehlt!',
14 14
  ' bytes, max='                => ' Bytes, Maximum=',
15 15
  ' missing!'                   => ' fehlt!',
16
  '"#1" seems to be a faulty list of email addresses. After extracing addresses (#2) too many characters are left.' => '"#1" scheint fehlerhaft zu sein. Es wurden E-Mail Adressen extrahiert (#2), aber es sind noch zu viele Zeichen übrig.',
17
  '"#1" seems to be a faulty list of email addresses. No addresses could be extracted.' => '"#1" scheint fehlerhaft zu sein. Es konnte keine E-Mail Adresse extrahiert werden',
16 18
  '#1 (custom variable)'        => '#1 (benutzerdefinierte Variable)',
17 19
  '#1 MD'                       => '#1 PT',
18 20
  '#1 additional part(s)'       => '#1 zusätzliche(r) Artikel',

Auch abrufbar als: Unified diff