changeset 240:e1d0a8576342

Allow location of snedmail to vary
author Steve Kemp <steve@steve.org.uk>
date Fri, 16 May 2008 17:37:07 +0100
parents 86e95adc325b
children a534e06653dd
files cgi-bin/comments.cgi
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/cgi-bin/comments.cgi	Fri May 16 17:36:55 2008 +0100
+++ b/cgi-bin/comments.cgi	Fri May 16 17:37:07 2008 +0100
@@ -50,6 +50,14 @@
 my $TO   = 'weblog@steve.org.uk';
 my $FROM = 'weblog@steve.org.uk';
 
+#
+#  Find sendmail
+#
+my $SENDMAIL = undef;
+foreach my $file ( qw ! /usr/lib/sendmail /usr/sbin/sendmail ! )
+{
+    $SENDMAIL = $file if ( -x $file );
+}
 
 
 #
@@ -154,9 +162,9 @@
 #
 #  Send a mail.
 #
-if ( length($TO) && length($FROM) )
+if ( length($TO) && length($FROM) && defined( $SENDMAIL ) )
 {
-    open( SENDMAIL, "|/usr/lib/sendmail -t -f $FROM" );
+    open( SENDMAIL, "|$SENDMAIL -t -f $FROM" );
     print SENDMAIL "To: $TO\n";
     print SENDMAIL "From: $FROM\n";
     print SENDMAIL "Subject: New Comment [$id]\n";