CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
form mail delimiter change

 



tperino
Deleted

Dec 30, 2000, 9:46 PM

Post #1 of 1 (253 views)
form mail delimiter change Can't Post

Hi all:

I am trying to change the delimiters on info that is sent to me in the email body via an HTML form/cgi script configuration.

Currently, the email is delivered using colons (:) as delimiters, which is the same used for the email header info (to, from subject). I would like the info from the body of the email form to have an equal sign (=) as the delimiter so it can be stripped from the email and stored in a .txt file (without the header stuff).

Here's the subroutine where I think the change needs to be made:

#!!! This subroutines sends email to the recipient.
#!!!


sub print_mail {

my ($name, $value, $pair, $submitter_email, $submitter_name);
my ($subject, $replyto, $cc, $to, $bcc);

$to = ""; $cc = $to; $bcc = $cc;
# Determine who the submitter is and their email address
foreach $pair (@VARS) {
($name, $value) = split (/\t/, $pair);
if ($name =~ /^email$/i) { $submitter_email = $value; }
if ($name =~ /^e-mail$/i) { $submitter_email = $value; }
if ($name =~ /^name$/i) { $submitter_name = $value; }
if ($name =~ /^bcc$/i) {
if ($bcc eq "") {
$bcc = $value;
} else {
$bcc = "$bcc, $value";
} # end if else
} # end if
if ($name =~ /^cc$/i) {
if ($cc eq "") {
$cc = $value;
} else {
$cc = "$cc, $value";
} # end if else
} # end if
if ($name =~ /^to$/i) {
if ($to eq "") {
$to = $value;
} else {
$to = "$to, $value";
} # end if else
} # end if
} # end foreach

# Send mail to recipient

open (MAIL, "|$MAILPROG\n") || &mydie ("Can't open $MAILPROG", $!);

if ($FORM{'subject'} ne "") {
$subject = $FORM{'subject'};
} # end if
else { $subject = "Submission from $ENV{'HTTP_REFERER'}"; }
$replyto = $submitter_email;

&print_email_header (
$to, $cc, $bcc,
$submitter_email, $submitter_name,
$replyto, $subject
); # end print_email_header

&print_automatic_parse;

&print_email_footer;

close(MAIL);

} # end print_mail

Thanx for any hints offered!

Tom





 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives