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

(-)a/C4/Letters.pm (-9 / +12 lines)
Lines 580-597 sub SendAlerts { Link Here
580
580
581
        # ... then send mail
581
        # ... then send mail
582
        my $library = Koha::Libraries->find( $userenv->{branch} );
582
        my $library = Koha::Libraries->find( $userenv->{branch} );
583
        my %mail = (
583
        my $email = Koha::Email->new();
584
            To => join( ',', @email),
584
        my %mail = $email->create_message_headers(
585
            Cc             => join( ',', @cc),
585
            {
586
            From           => $library->branchemail || C4::Context->preference('KohaAdminEmailAddress'),
586
                to      => join( ',', @email),
587
            Subject        => Encode::encode( "UTF-8", "" . $letter->{title} ),
587
                cc      => join( ',', @cc),
588
            Message => $letter->{'is_html'}
588
                from    => $library->branchemail || C4::Context->preference('KohaAdminEmailAddress'),
589
                subject => Encode::encode( "UTF-8", "" . $letter->{title} ),
590
                message => $letter->{'is_html'}
589
                            ? _wrap_html( Encode::encode( "UTF-8", $letter->{'content'} ),
591
                            ? _wrap_html( Encode::encode( "UTF-8", $letter->{'content'} ),
590
                                          Encode::encode( "UTF-8", "" . $letter->{'title'} ))
592
                                          Encode::encode( "UTF-8", "" . $letter->{'title'} ))
591
                            : Encode::encode( "UTF-8", "" . $letter->{'content'} ),
593
                            : Encode::encode( "UTF-8", "" . $letter->{'content'} ),
592
            'Content-Type' => $letter->{'is_html'}
594
                contenttype => $letter->{'is_html'}
593
                                ? 'text/html; charset="utf-8"'
595
                                ? 'text/html; charset="utf-8"'
594
                                : 'text/plain; charset="utf-8"',
596
                                : 'text/plain; charset="utf-8"',
597
            }
595
        );
598
        );
596
599
597
        if ($type eq 'claimacquisition' || $type eq 'claimissues' ) {
600
        if ($type eq 'claimacquisition' || $type eq 'claimissues' ) {
Lines 600-606 sub SendAlerts { Link Here
600
            $mail{'Sender'} = C4::Context->preference('ReturnpathDefault')
603
            $mail{'Sender'} = C4::Context->preference('ReturnpathDefault')
601
              if C4::Context->preference('ReturnpathDefault');
604
              if C4::Context->preference('ReturnpathDefault');
602
            $mail{'Bcc'} = $userenv->{emailaddress}
605
            $mail{'Bcc'} = $userenv->{emailaddress}
603
              if C4::Context->preference("ClaimsBccCopy");
606
              if C4::Context->preference("ClaimsBccCopy") and not C4::Context->preference("SendAllEmailsTo");
604
        }
607
        }
605
608
606
        unless ( Mail::Sendmail::sendmail(%mail) ) {
609
        unless ( Mail::Sendmail::sendmail(%mail) ) {
Lines 1396-1402 sub _send_message_by_email { Link Here
1396
1399
1397
    $sendmail_params{'Auth'} = {user => $username, pass => $password, method => $method} if $username;
1400
    $sendmail_params{'Auth'} = {user => $username, pass => $password, method => $method} if $username;
1398
    if ( my $bcc = C4::Context->preference('NoticeBcc') ) {
1401
    if ( my $bcc = C4::Context->preference('NoticeBcc') ) {
1399
       $sendmail_params{ Bcc } = $bcc;
1402
       $sendmail_params{ Bcc } = C4::Context->preference("SendAllEmailsTo") || $bcc;
1400
    }
1403
    }
1401
1404
1402
    _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
1405
    _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
(-)a/Koha/Email.pm (-1 / +3 lines)
Lines 54-59 sub create_message_headers { Link Here
54
    if (C4::Context->preference('SendAllEmailsTo') && Email::Valid->address(C4::Context->preference('SendAllEmailsTo'))) {
54
    if (C4::Context->preference('SendAllEmailsTo') && Email::Valid->address(C4::Context->preference('SendAllEmailsTo'))) {
55
        $mail{'To'} = C4::Context->preference('SendAllEmailsTo');
55
        $mail{'To'} = C4::Context->preference('SendAllEmailsTo');
56
    }
56
    }
57
    else {
58
        $mail{'Cc'} = $params->{cc};
59
    }
57
60
58
    if ( C4::Context->preference('ReplytoDefault') ) {
61
    if ( C4::Context->preference('ReplytoDefault') ) {
59
        $params->{replyto} ||= C4::Context->preference('ReplytoDefault');
62
        $params->{replyto} ||= C4::Context->preference('ReplytoDefault');
60
- 

Return to bug 8000