On 22 Jan 2004 07:03:34 -0800,
(Duke of Hazard)
wrote:
Your script is similar to a script I have. I think you could use a some
error management, an easer style, and a tip on email headers.
>Here's the code pasted below. Everything works as it should, except
>the last line seems to get printed twice.
>
>################################################# ##
># mailing faraz_hussainyahoo.com cc'ing $x_email1 #
>################################################# ##
>
>$mail_prog = '/usr/sbin/sendmail -t' ;
>
>
>if ($x_email1) {
>
>open (MAIL, "|$mail_prog");
If this open fails, which happens, then your script will fail and you
won't know it. Try this...
open MAIL, "|/usr/sbin/sendmail -t" or die "Can't open sendmail: $!\n";
You then go through each line with it's own print statement, nothing
wrong with this, but it is easer to follow/maintain/format if you...
print MAIL <<eof;
From: $r0
To: $r0,$r1,$r2,$r3
Cc: $x_email1
Subject: ISRA - New member
The following person has joined ISRA
====================================
<insert the rest of the body here>
eof
close MAIL or die "Can't close sendmail: $!/$?\n";
} # end of if
>print MAIL "From: $r0\n";
>print MAIL "To: $r0,$r1,$r2,$r3\n";
>print MAIL "Cc: $x_email1\n";
>print MAIL "Subject: ISRA - New member\n";
>print MAIL "The following person has joined ISRA\n";
Here I want to point out that there MUST be a blank line between the
last header and the body of the email. This may seem like I'm picking a
nit, but it's not really me... every email related program requires it
as the separator between header and body. This may well be what is
causing the problem you are looking for.
Brad
--
"He who asks is a fool for five minutes, but he who does not ask remains
a fool forever." Chinese proverb
Bradley W. Olin
http://www.bwo1.com