View | Details | Raw Unified | Return to bug 26705
Collapse All | Expand All

(-)a/Koha/Email.pm (-1 / +34 lines)
Lines 136-139 sub create { Link Here
136
    return $email;
136
    return $email;
137
}
137
}
138
138
139
=head3 send_or_die
140
141
    $email->send_or_die({ transport => $transport [, $args] });
142
143
Overloaded Email::Stuffer I<send_or_die> method, that takes care of Bcc handling.
144
Bcc is removed from the message headers, and included in the recipients list to be
145
passed to I<send_or_die>.
146
147
=cut
148
149
sub send_or_die {
150
    my ( $self, $args ) = @_;
151
152
    unless ( $args->{to} ) {    # don't do it if passed an explicit 'to' param
153
154
        my @recipients;
155
156
        # extract all recipient addresses from header
157
        foreach my $header ( 'To', 'Cc', 'Bcc' ) {
158
            push @recipients,
159
              map { $_->as_string }
160
              $self->email->header_obj->header_as_obj($header)->addresses;
161
        }
162
163
        # Remove the Bcc header
164
        $self->email->header_str_set('Bcc');
165
166
        # Tweak $args
167
        $args->{to} = \@recipients;
168
    }
169
170
    $self->SUPER::send_or_die($args);
171
}
172
139
1;
173
1;
140
- 

Return to bug 26705