[LON-CAPA-cvs] cvs: loncom /interface lonmsg.pm

www lon-capa-cvs@mail.lon-capa.org
Wed, 15 Oct 2003 20:34:37 -0000


www		Wed Oct 15 16:34:37 2003 EDT

  Modified files:              
    /loncom/interface	lonmsg.pm 
  Log:
  Trying to address Bug #2197: do not print to mail handle if it could not be
  opened.
  
  
Index: loncom/interface/lonmsg.pm
diff -u loncom/interface/lonmsg.pm:1.67 loncom/interface/lonmsg.pm:1.68
--- loncom/interface/lonmsg.pm:1.67	Wed Oct 15 14:01:10 2003
+++ loncom/interface/lonmsg.pm	Wed Oct 15 16:34:37 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines for messaging
 #
-# $Id: lonmsg.pm,v 1.67 2003/10/15 18:01:10 www Exp $
+# $Id: lonmsg.pm,v 1.68 2003/10/15 20:34:37 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -218,9 +218,10 @@
     my $msg = new Mail::Send;
     $msg->to($to);
     $msg->subject('[LON-CAPA] '.$subject);
-    my $fh = $msg->open('smtp',Server => 'localhost');
-    print $fh $body;
-    $fh->close;
+    if (my $fh = $msg->open('smtp',Server => 'localhost')) {
+	print $fh $body;
+	$fh->close;
+    }
 }
 
 # ==================================================== Send notification emails