
November 22nd, 2012, 09:02 AM
|
|
Registered User
|
|
Join Date: Nov 2012
Posts: 1
Time spent in forums: 14 m 53 sec
Reputation Power: 0
|
|
|
Merging two contact form fields
Good morning all...
I'm pretty new to cgi so please bear with me.. I have been tasked with incorporating a contact us form in our community theater's existing site. At some later date that same form may have to update mailchimp, but baby steps for now. One of the things that I would like to do is to add a prefix to the subject of the mails that are generated so that submissions could be easily identified by the theater admin (who also receives non-form based email at with same email address.)
I have pasted the mail routine below. On the form, there is also a hidden field called 'site' which contains the url of the site. Is there a way to combine the subject field from the form along with the hidden field so the that mail's subject field takes on the format of: site - subject ?
sub mail_it
{
my $theMail = "To: $RECIPIENT\n";
my $tmp = $fields{'from'};
if( defined($fields{'sendername'}) && $fields{'sendername'} ne "" ) {
$tmp = "\"$fields{'sendername'}\" <$tmp>";
}
$theMail .= "From: $tmp\n";
if( defined($fields{'sendername'}) && $fields{'carboncopy'} eq 'on' ) {
$theMail .= "Cc: $tmp\n";
}
$theMail .= "Subject: $fields{'subject'}\n";
$theMail .= "Return-Path: <$fields{'from'}>\n";
$theMail .= xHeaders() ."\n"; # end of headers
$theMail .= "First Name: $fields{'sendername'}\n\n";
$theMail .= "Last Name: $fields{'lastname'}\n\n";
$theMail .= "Email address: $fields{'from'}\n\n";
$theMail .= "Telephone: $fields{'telephone'}\n\n";
$theMail .= "Subject: $fields{'subject'}\n\n";
$theMail .= "Mesage: $fields{'message'}\n\n";
open(MZT,"|$MAIL_PROGRAM -t") || die "Unable to send mail: $^E";
print MZT $theMail;
close(MZT);
return $theMail;
}
Many thanks in advance,
Marko
|