- # if it looks like a username / local only email
- if ($address_string !~ /@/ && $address_string =~ /^\w+$/) {
- my $user = RT::User->new( RT->SystemUser );
- my ($id, $msg) = $user->Load($address_string);
- if ($id) {
- push @addresses, Email::Address->new($user->Name,$user->EmailAddress);
+ foreach my $e ( @list ) {
+ if ($e->{'type'} eq 'mailbox') {
+ if ($e->{'not_ascii'}) {
+ $logger->($e->{'value'} ." contains not ASCII values");
+ next;
+ }
+ push @addresses, $e->{'value'}
+ } elsif ( $e->{'value'} =~ /^\s*(\w+)\s*$/ ) {
+ my $user = RT::User->new( RT->SystemUser );
+ $user->Load( $1 );
+ if ($user->id) {
+ push @addresses, Email::Address->new($user->Name, $user->EmailAddress);
+ } else {
+ $logger->($e->{'value'} ." is not a valid email address and is not user name");
+ }