From: Stephen L Johnson Date: Wed, 8 May 2002 15:11:02 +0000 (+0000) Subject: added code to email() to add correct Content-Type: is HTML code is in message body X-Git-Tag: spong-2_7_7~10 X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a3095cb99c6886453c3deeb37e00f5aa736412f2;p=spong.git added code to email() to add correct Content-Type: is HTML code is in message body added new !!DETAILEDHTML!! field for templates which HTMLizes the message field --- diff --git a/src/spong-message.pl b/src/spong-message.pl index d73f4c7..5bc76ef 100755 --- a/src/spong-message.pl +++ b/src/spong-message.pl @@ -12,7 +12,7 @@ # (2) Added rules based paging (Stephen Johnson Nov 14, 1998) # (3) Added checks against Acks and downtime (Stephen Johnson Mar 17, 1999) # -# $Id: spong-message.pl,v 1.34 2002/05/07 18:39:45 sljohnson Exp $ +# $Id: spong-message.pl,v 1.35 2002/05/08 15:11:02 sljohnson Exp $ use lib "@@LIBDIR@@"; @@ -848,6 +848,11 @@ sub fill_in { $tmp = strftime($DATETIMEFMT,localtime($time)); $str =~ s/!!DATETIME!!/$tmp/g; } + if ($str =~ /!!DETAILEDHTML!!/) { + $tmp = $message; + $tmp =~ s/\n/
\n/mg; + $str =~ s/!!DETAILEDHTML!!/$tmp/g; + } return $str; } @@ -862,7 +867,11 @@ sub email { open( MAIL, "|$SENDMAIL" ) || die "Can't open sendmail: $!"; print MAIL "To: $recipient\n"; print MAIL "Subject: $subject\n"; - print MAIL "Content-Type: text/plain; charset=us-ascii\n"; + if ( grep(//,$body) ) { + print MAIL "Content-Type: text/html; charset=us-ascii\n"; + } else { + print MAIL "Content-Type: text/plain; charset=us-ascii\n"; + } print MAIL "\n"; # Header/Body boundry print MAIL "$body\n"; close( MAIL );