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

(-)a/C4/Letters.pm (-41 / +40 lines)
Lines 324-347 sub SendAlerts { Link Here
324
            ) or return;
324
            ) or return;
325
325
326
            # FIXME: This 'default' behaviour should be moved to Koha::Email
326
            # FIXME: This 'default' behaviour should be moved to Koha::Email
327
            my $mail = Koha::Email->create(
327
            my $success = try {
328
                {
328
                my $mail = Koha::Email->create(
329
                    to       => $email,
329
                    {
330
                    from     => $library->branchemail,
330
                        to       => $email,
331
                    reply_to => $library->branchreplyto,
331
                        from     => $library->branchemail,
332
                    sender   => $library->branchreturnpath,
332
                        reply_to => $library->branchreplyto,
333
                    subject  => "" . $letter->{title},
333
                        sender   => $library->branchreturnpath,
334
                }
334
                        subject  => "" . $letter->{title},
335
            );
335
                    }
336
                );
336
337
337
            if ( $letter->{is_html} ) {
338
                if ( $letter->{is_html} ) {
338
                $mail->html_body( _wrap_html( $letter->{content}, "" . $letter->{title} ) );
339
                    $mail->html_body( _wrap_html( $letter->{content}, "" . $letter->{title} ) );
339
            }
340
                }
340
            else {
341
                else {
341
                $mail->text_body( $letter->{content} );
342
                    $mail->text_body( $letter->{content} );
342
            }
343
                }
343
344
344
            my $success = try {
345
                $mail->send_or_die({ transport => $library->smtp_server->transport });
345
                $mail->send_or_die({ transport => $library->smtp_server->transport });
346
            }
346
            }
347
            catch {
347
            catch {
Lines 475-507 sub SendAlerts { Link Here
475
475
476
        # ... then send mail
476
        # ... then send mail
477
        my $library = Koha::Libraries->find( $userenv->{branch} );
477
        my $library = Koha::Libraries->find( $userenv->{branch} );
478
        my $mail = Koha::Email->create(
478
        my $success = try {
479
            {
479
            my $mail = Koha::Email->create(
480
                to => join( ',', @email ),
480
                {
481
                cc => join( ',', @cc ),
481
                    to => join( ',', @email ),
482
                (
482
                    cc => join( ',', @cc ),
483
                    (
483
                    (
484
                        C4::Context->preference("ClaimsBccCopy")
484
                        (
485
                          && ( $type eq 'claimacquisition'
485
                            C4::Context->preference("ClaimsBccCopy")
486
                            || $type eq 'claimissues' )
486
                              && ( $type eq 'claimacquisition'
487
                    )
487
                                || $type eq 'claimissues' )
488
                    ? ( bcc => $userenv->{emailaddress} )
488
                        )
489
                    : ()
489
                        ? ( bcc => $userenv->{emailaddress} )
490
                ),
490
                        : ()
491
                from => $library->branchemail
491
                    ),
492
                  || C4::Context->preference('KohaAdminEmailAddress'),
492
                    from => $library->branchemail
493
                subject => "" . $letter->{title},
493
                      || C4::Context->preference('KohaAdminEmailAddress'),
494
            }
494
                    subject => "" . $letter->{title},
495
        );
495
                }
496
            );
496
497
497
        if ( $letter->{is_html} ) {
498
            if ( $letter->{is_html} ) {
498
            $mail->html_body( _wrap_html( $letter->{content}, "" . $letter->{title} ) );
499
                $mail->html_body( _wrap_html( $letter->{content}, "" . $letter->{title} ) );
499
        }
500
            }
500
        else {
501
            else {
501
            $mail->text_body( "" . $letter->{content} );
502
                $mail->text_body( "" . $letter->{content} );
502
        }
503
            }
503
504
504
        my $success = try {
505
            $mail->send_or_die({ transport => $library->smtp_server->transport });
505
            $mail->send_or_die({ transport => $library->smtp_server->transport });
506
        }
506
        }
507
        catch {
507
        catch {
508
- 

Return to bug 28996