mountainfair
Programmer
I am a total beginner to perl.
I want to send a confirmation email to me and to the person that submitted the form, with the body of the confirmation email having the name of the input and then the input, like this:
Name: john
email: asdf@adsf.com
age: 24
etc.
Instead of the current:
john
asdf@asdf.com
24
etc.
Right now, I have gotten as far as getting a confirmation email sent to me (but not the submitted email), and no labels for each of the fields in the body of the email.
Can anyone help?
I have added this to my existing script that tracks user signups (I have included the relevant part of the code that was already there):
I want to send a confirmation email to me and to the person that submitted the form, with the body of the confirmation email having the name of the input and then the input, like this:
Name: john
email: asdf@adsf.com
age: 24
etc.
Instead of the current:
john
asdf@asdf.com
24
etc.
Right now, I have gotten as far as getting a confirmation email sent to me (but not the submitted email), and no labels for each of the fields in the body of the email.
Can anyone help?
I have added this to my existing script that tracks user signups (I have included the relevant part of the code that was already there):
Code:
$input = <STDIN>; chomp; chomp;
@fields = split("&",$input);
foreach $one (@fields)
{
($name, $value) = split ("=",$one);
$name =~ s/\+/ /g;
$name =~ s/%(..)/pack("c",hex($1))/ge;
$value =~ s/\+/ /g;
$value =~ s/%(..)/pack("c",hex($1))/ge;
$value =~ s/\t/ /g; # strip out tab DB field-separators from the data
$value =~ s/\n//g; # and newline record-separators.
# if non-unique names are present, catch here & store
# (e.g. checkbox/select fileds) else below...
$vararray{"$name"}=$value;
# email confirmation added by Mountainfair
$record2 = '';# initialize
# this next bit is to control the order of fields in the log...
@fieldlist = ('handle','nickname',
'age','email','phone','training','address','bestprecontact','skills',
'certifications','find','emergency','comments');
foreach $field ( @fieldlist ) {
$record2 .= $vararray{"$field"}."\n";
} # end foreach
$record2 .= localtime(time); # timestamp for later data checks
$mailprog = '/usr/bin/sendmail';
open(MAIL,"|$mailprog -t");
print MAIL "To: test\@test.org\n";
print MAIL "From: Volunteer Coordinator <volunteer\@test.org>\n";
print MAIL "Subject: Volunteer Confirmation\n";
print MAIL "This is the contents of your Volunteer registration:\n\n$record2\n\n";
close (MAIL);
# end email confirmation added by Mountainfair