X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/8a40e3dd0f638557b8c666fe708ccbc1ac709c4e..7635f647ec7dcdef51684b21601ee0930ea2bc5b:/SL/Mailer.pm diff --git a/SL/Mailer.pm b/SL/Mailer.pm index 2857e1c75..f5b3b7764 100644 --- a/SL/Mailer.pm +++ b/SL/Mailer.pm @@ -83,16 +83,23 @@ sub _create_message_id { sub _create_address_headers { my ($self) = @_; + # $self->{addresses} collects the recipients for use in e.g. the + # SMTP 'RCPT TO:' envelope command. $self->{headers} collects the + # headers that make up the actual email. 'BCC' should not be + # included there for certain transportation methods (SMTP). + $self->{addresses} = {}; foreach my $item (qw(from to cc bcc)) { $self->{addresses}->{$item} = []; - next if !$self->{$item} || $self->{driver}->keep_from_header($item); + next if !$self->{$item}; my @header_addresses; foreach my $addr_obj (Email::Address->parse($self->{$item})) { push @{ $self->{addresses}->{$item} }, $addr_obj->address; + next if $self->{driver}->keep_from_header($item); + my $phrase = $addr_obj->phrase(); if ($phrase) { $phrase =~ s/^\"//; @@ -187,7 +194,7 @@ sub send { $self->{contenttype} ||= "text/plain"; $self->{headers} = [ Subject => $self->{subject}, - 'Message-ID' => $self->_create_message_id, + 'Message-ID' => '<' . $self->_create_message_id . '>', 'X-Mailer' => "kivitendo $self->{version}", ];