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

(-)a/C4/Letters.pm (-22 / +25 lines)
Lines 483-511 sub SendAlerts { Link Here
483
        my $email = Koha::Email->new();
483
        my $email = Koha::Email->new();
484
        my %mail = $email->create_message_headers(
484
        my %mail = $email->create_message_headers(
485
            {
485
            {
486
                to      => join( ',', @email),
486
                to => join( ',', @email ),
487
                cc      => join( ',', @cc),
487
                cc => join( ',', @cc ),
488
                from    => $library->branchemail || C4::Context->preference('KohaAdminEmailAddress'),
488
                (
489
                    (
490
                        C4::Context->preference("ClaimsBccCopy")
491
                          && ( $type eq 'claimacquisition'
492
                            || $type eq 'claimissues' )
493
                    ) ? ( bcc => $userenv->{emailaddress} )
494
                    : ()
495
                ),
496
                from => $library->branchemail
497
                  || C4::Context->preference('KohaAdminEmailAddress'),
489
                subject => Encode::encode( "UTF-8", "" . $letter->{title} ),
498
                subject => Encode::encode( "UTF-8", "" . $letter->{title} ),
490
                message => $letter->{'is_html'}
499
                message => $letter->{'is_html'} ? _wrap_html(
491
                            ? _wrap_html( Encode::encode( "UTF-8", $letter->{'content'} ),
500
                    Encode::encode( "UTF-8", $letter->{'content'} ),
492
                                          Encode::encode( "UTF-8", "" . $letter->{'title'} ))
501
                    Encode::encode( "UTF-8", "" . $letter->{'title'} )
493
                            : Encode::encode( "UTF-8", "" . $letter->{'content'} ),
502
                  )
503
                : Encode::encode( "UTF-8", "" . $letter->{'content'} ),
494
                contenttype => $letter->{'is_html'}
504
                contenttype => $letter->{'is_html'}
495
                                ? 'text/html; charset="utf-8"'
505
                ? 'text/html; charset="utf-8"'
496
                                : 'text/plain; charset="utf-8"',
506
                : 'text/plain; charset="utf-8"',
497
            }
507
            }
498
        );
508
        );
499
509
500
        if ($type eq 'claimacquisition' || $type eq 'claimissues' ) {
501
            $mail{'Reply-to'} = C4::Context->preference('ReplytoDefault')
502
              if C4::Context->preference('ReplytoDefault');
503
            $mail{'Sender'} = C4::Context->preference('ReturnpathDefault')
504
              if C4::Context->preference('ReturnpathDefault');
505
            $mail{'Bcc'} = $userenv->{emailaddress}
506
              if C4::Context->preference("ClaimsBccCopy") and not C4::Context->preference("SendAllEmailsTo");
507
        }
508
509
        unless ( Mail::Sendmail::sendmail(%mail) ) {
510
        unless ( Mail::Sendmail::sendmail(%mail) ) {
510
            carp $Mail::Sendmail::error;
511
            carp $Mail::Sendmail::error;
511
            return { error => $Mail::Sendmail::error };
512
            return { error => $Mail::Sendmail::error };
Lines 1296-1302 sub _send_message_by_email { Link Here
1296
    my $email = Koha::Email->new();
1297
    my $email = Koha::Email->new();
1297
    my %sendmail_params = $email->create_message_headers(
1298
    my %sendmail_params = $email->create_message_headers(
1298
        {
1299
        {
1299
            to      => $to_address,
1300
            to => $to_address,
1301
            (
1302
                C4::Context->preference('NoticeBcc')
1303
                ? ( bcc => C4::Context->preference('NoticeBcc') )
1304
                : ()
1305
            ),
1300
            from    => $message->{'from_address'} || $branch_email,
1306
            from    => $message->{'from_address'} || $branch_email,
1301
            replyto => $branch_replyto,
1307
            replyto => $branch_replyto,
1302
            sender  => $branch_returnpath,
1308
            sender  => $branch_returnpath,
Lines 1307-1315 sub _send_message_by_email { Link Here
1307
    );
1313
    );
1308
1314
1309
    $sendmail_params{'Auth'} = {user => $username, pass => $password, method => $method} if $username;
1315
    $sendmail_params{'Auth'} = {user => $username, pass => $password, method => $method} if $username;
1310
    if ( my $bcc = C4::Context->preference('NoticeBcc') ) {
1311
       $sendmail_params{ Bcc } = C4::Context->preference("SendAllEmailsTo") || $bcc;
1312
    }
1313
1316
1314
    _update_message_to_address($message->{'message_id'},$to_address) unless $message->{to_address}; #if initial message address was empty, coming here means that a to address was found and queue should be updated
1317
    _update_message_to_address($message->{'message_id'},$to_address) unless $message->{to_address}; #if initial message address was empty, coming here means that a to address was found and queue should be updated
1315
1318
(-)a/Koha/Email.pm (-1 / +1 lines)
Lines 56-61 sub create_message_headers { Link Here
56
    }
56
    }
57
    else {
57
    else {
58
        $mail{'Cc'} = $params->{cc};
58
        $mail{'Cc'} = $params->{cc};
59
        $mail{'Bcc'} = $params->{bcc};
59
    }
60
    }
60
61
61
    if ( C4::Context->preference('ReplytoDefault') ) {
62
    if ( C4::Context->preference('ReplytoDefault') ) {
62
- 

Return to bug 8000