From ee9dd69ba50fb2f6a443a1c22b91f3b46e6da5ec Mon Sep 17 00:00:00 2001
From: Mark Tompsett <mtompset@hotmail.com>
Date: Mon, 26 Mar 2018 16:46:19 +0000
Subject: [PATCH] Bug 20474: Explicitly call sendmail to make mocking work

---
 C4/Letters.pm | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/C4/Letters.pm b/C4/Letters.pm
index b76338e..2dfb99d 100644
--- a/C4/Letters.pm
+++ b/C4/Letters.pm
@@ -458,7 +458,7 @@ sub SendAlerts {
                                     : 'text/plain; charset="utf-8"',
                 }
             );
-            unless( sendmail(%mail) ) {
+            unless( Mail::Sendmail::sendmail(%mail) ) {
                 carp $Mail::Sendmail::error;
                 return { error => $Mail::Sendmail::error };
             }
@@ -603,7 +603,7 @@ sub SendAlerts {
               if C4::Context->preference("ClaimsBccCopy");
         }
 
-        unless ( sendmail(%mail) ) {
+        unless ( Mail::Sendmail::sendmail(%mail) ) {
             carp $Mail::Sendmail::error;
             return { error => $Mail::Sendmail::error };
         }
@@ -652,7 +652,7 @@ sub SendAlerts {
                                 : 'text/plain; charset="utf-8"',
             }
         );
-        unless( sendmail(%mail) ) {
+        unless( Mail::Sendmail::sendmail(%mail) ) {
             carp $Mail::Sendmail::error;
             return { error => $Mail::Sendmail::error };
         }
@@ -1395,7 +1395,7 @@ sub _send_message_by_email {
 
     _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
 
-    if ( sendmail( %sendmail_params ) ) {
+    if ( Mail::Sendmail::sendmail( %sendmail_params ) ) {
         _set_message_status( { message_id => $message->{'message_id'},
                 status     => 'sent' } );
         return 1;
-- 
2.1.4