[Koha-patches] [PATCH] Bug 3810 Mail::Sendmail should not fail silently

Colin Campbell colin.campbell at ptfs-europe.com
Wed Nov 25 19:18:52 CET 2009


The return from Mail::Sendmail should always be checked
This is not a solution to problems with claims etc but at least
we should have some minimal debugging if it does nothing
---
 C4/Letters.pm     |    8 ++++----
 C4/Suggestions.pm |    3 ++-
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/C4/Letters.pm b/C4/Letters.pm
index 533dcb5..caa41ab 100644
--- a/C4/Letters.pm
+++ b/C4/Letters.pm
@@ -283,7 +283,7 @@ sub SendAlerts {
                     Message => "" . $innerletter->{content},
                     'Content-Type' => 'text/plain; charset="utf8"',
                     );
-                sendmail(%mail);
+                sendmail(%mail) or carp $Mail::Sendmail::error;
 
 # warn "sending to $mail{To} From $mail{From} subj $mail{Subject} Mess $mail{Message}";
             }
@@ -344,7 +344,7 @@ sub SendAlerts {
                 Message        => "" . $innerletter->{content},
                 'Content-Type' => 'text/plain; charset="utf8"',
             );
-            sendmail(%mail);
+            sendmail(%mail) or carp $Mail::Sendmail::error;
             warn
 "sending to $mail{To} From $mail{From} subj $mail{Subject} Mess $mail{Message}";
         }
@@ -422,7 +422,7 @@ sub SendAlerts {
                 Message => $mail_msg,
                 'Content-Type' => 'text/plain; charset="utf8"',
             );
-            sendmail(%mail);
+            sendmail(%mail) or carp $Mail::Sendmail::error;
             logaction(
                 "ACQUISITION",
                 "CLAIM ISSUE",
@@ -453,7 +453,7 @@ sub SendAlerts {
                 Message => $letter->{'content'},
                 'Content-Type' => 'text/plain; charset="utf8"',
         );
-        sendmail(%mail);
+        sendmail(%mail) or carp $Mail::Sendmail::error;
     }
 }
 
diff --git a/C4/Suggestions.pm b/C4/Suggestions.pm
index 491739c..0616a47 100644
--- a/C4/Suggestions.pm
+++ b/C4/Suggestions.pm
@@ -21,6 +21,7 @@ package C4::Suggestions;
 use strict;
 use CGI;
 use Mail::Sendmail;
+use Carp;
 
 use C4::Context;
 use C4::Output;
@@ -445,7 +446,7 @@ sub ModStatus {
         Message => "".$template->output,
         'Content-Type' => 'text/plain; charset="utf8"',
     );
-    sendmail(%mail);
+    sendmail(%mail) or carp $Mail::Sendmail::error;
 }
 
 =head2 ConnectSuggestionAndBiblio
-- 
1.6.5.2




More information about the Koha-patches mailing list