comparison cgi-bin/comments.cgi @ 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 053c52c4516f
children aaff32519e78
comparison
equal deleted inserted replaced
239:86e95adc325b 240:e1d0a8576342
48 # The notification addresses - leave blank to disable 48 # The notification addresses - leave blank to disable
49 # 49 #
50 my $TO = 'weblog@steve.org.uk'; 50 my $TO = 'weblog@steve.org.uk';
51 my $FROM = 'weblog@steve.org.uk'; 51 my $FROM = 'weblog@steve.org.uk';
52 52
53 #
54 # Find sendmail
55 #
56 my $SENDMAIL = undef;
57 foreach my $file ( qw ! /usr/lib/sendmail /usr/sbin/sendmail ! )
58 {
59 $SENDMAIL = $file if ( -x $file );
60 }
53 61
54 62
55 # 63 #
56 # Get the parameters from the request. 64 # Get the parameters from the request.
57 # 65 #
152 160
153 161
154 # 162 #
155 # Send a mail. 163 # Send a mail.
156 # 164 #
157 if ( length($TO) && length($FROM) ) 165 if ( length($TO) && length($FROM) && defined( $SENDMAIL ) )
158 { 166 {
159 open( SENDMAIL, "|/usr/lib/sendmail -t -f $FROM" ); 167 open( SENDMAIL, "|$SENDMAIL -t -f $FROM" );
160 print SENDMAIL "To: $TO\n"; 168 print SENDMAIL "To: $TO\n";
161 print SENDMAIL "From: $FROM\n"; 169 print SENDMAIL "From: $FROM\n";
162 print SENDMAIL "Subject: New Comment [$id]\n"; 170 print SENDMAIL "Subject: New Comment [$id]\n";
163 print SENDMAIL "\n\n"; 171 print SENDMAIL "\n\n";
164 print SENDMAIL `cat $file`; 172 print SENDMAIL `cat $file`;