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 1306-1312 sub _send_message_by_email { Link Here
1306
    my $email = Koha::Email->new();
1307
    my $email = Koha::Email->new();
1307
    my %sendmail_params = $email->create_message_headers(
1308
    my %sendmail_params = $email->create_message_headers(
1308
        {
1309
        {
1309
            to      => $to_address,
1310
            to => $to_address,
1311
            (
1312
                C4::Context->preference('NoticeBcc')
1313
                ? ( bcc => C4::Context->preference('NoticeBcc') )
1314
                : ()
1315
            ),
1310
            from    => $message->{'from_address'} || $branch_email,
1316
            from    => $message->{'from_address'} || $branch_email,
1311
            replyto => $branch_replyto,
1317
            replyto => $branch_replyto,
1312
            sender  => $branch_returnpath,
1318
            sender  => $branch_returnpath,
Lines 1317-1325 sub _send_message_by_email { Link Here
1317
    );
1323
    );
1318
1324
1319
    $sendmail_params{'Auth'} = {user => $username, pass => $password, method => $method} if $username;
1325
    $sendmail_params{'Auth'} = {user => $username, pass => $password, method => $method} if $username;
1320
    if ( my $bcc = C4::Context->preference('NoticeBcc') ) {
1321
       $sendmail_params{ Bcc } = C4::Context->preference("SendAllEmailsTo") || $bcc;
1322
    }
1323
1326
1324
    _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
1327
    _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
1325
1328
(-)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