diff options
author | Mark Wells <mark@freeside.biz> | 2016-12-14 13:00:24 -0800 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2016-12-14 13:00:24 -0800 |
commit | e031448c5911bd58dcf5daacae6c6755648fec5a (patch) | |
tree | 544de852fd0dc1a2357cfa8c6f1305789842167a /FS | |
parent | 75ab0df930bcbf5173cdda2ce7704fdcf09d9d39 (diff) |
fix parsing of multiple To: addresses, #73241
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/Misc.pm | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/FS/FS/Misc.pm b/FS/FS/Misc.pm index eedc736ee..ff5723fd7 100644 --- a/FS/FS/Misc.pm +++ b/FS/FS/Misc.pm @@ -254,13 +254,11 @@ sub send_email { } push @to, $options{bcc} if defined($options{bcc}); - # make sure - my @env_to = split(/\s*,\s*/, join(', ', @to)); - # strip display-name from envelope addresses - foreach (@env_to) { - s/^\s*//; - s/\s*$//; - s/^(.*)\s*<(.*@.*)>$/$2/; + # fully unpack all addresses found in @to (including Bcc) to make the + # envelope list + my @env_to; + foreach my $dest (@to) { + push @env_to, map { $_->address } Email::Address->parse($dest); } local $@; # just in case @@ -281,7 +279,7 @@ sub send_email { if ( $conf->exists('log_sent_mail') ) { my $cust_msg = FS::cust_msg->new({ 'env_from' => $options{'from'}, - 'env_to' => join(', ', @to), + 'env_to' => join(', ', @env_to), 'header' => $message->header_as_string, 'body' => $message->body_as_string, '_date' => $time, |