Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

passing recipient to a formhandler

Status
Not open for further replies.

sleepyfrog

Vendor
Apr 3, 2005
5
GB
Sorry if this is very basic;

I have a form handler which has recipient:
my $field_name_email = 'sendtoemailaddress';
$SendTo{'copies'} = 'fvs01@sleepyfrog.com';

However, I want to add a second recipient, but the email address is not fixed until the form has been created by cgi. Is there a way of passing this value from the form to get it included with the other recipient - the form value is:
<type="hidden" name="recipient" value="someone@somemail.com">

I tried:

my $field_name_email = 'sendtoemailaddress';
my $destination = "recipient";
$SendTo{'copies'} = 'fvs01@sleepyfrog.com, $destination';

but am obviously doing it wrong as it didn't work.

Any help would be very appreciated.
 
Code:
$SendTo{'copies'}      = 'fvs01@sleepyfrog.com,[COLOR=red][b]'.[/b][/color] $destination;

It might need a semicolon as a seperator though. The reason yours didn't work was variables aren't interpolated in single quotes
Code:
$destination="wherever\@wherever.com";
print "$destination\n";
print '$destination\n';

HTH
--Paul


cigless ...
 
Hi

Thanks for your reply. I tried

my $field_name_email = 'sendtoemailaddress';
$destination = "recipient";
$SendTo{'copies'} = 'try@sleepyfrog.com,';$destination;

It is sending to the first email, but not putting the 2nd email in.

The form is using a hidden field to provide the 2nd address :

<type="hidden" name="recipient" value="someone@somemail.com">

but this is not being put in the $SendTo list?

Thanks
 
try printing the value of $destination to a log, just b4 $SendTo{'copies'} is assigned, and make sure there's an actual [value] present.

I'm tired now, but ...
HTH
--Paul

cigless ...
 
Hi

Sorry, but you are assuming I know how to programme!!

I am altering a programme written by someone else and only have a very basic understanding of perl.

The value for the 2nd email address is passed by the form, as it gets added to the rest of the form data when sent to the main recipient.

I do not want it to be sent as a normal bit of info - I want it to add it into the sendto code.

recipient is the name of a hidden field in my form.
The value is written in with cgi when the page is created.
Clicking the form needs to put this value into the Sendto list in my emailer.

I'm sorry to be a pain but the answers given so far are not helping me.
 
my $destination = "recipient";

$destination is going to equal "recipient"

We'll need to see more code, partic the perl

--Paul

cigless ...
 
Oh, I see. Found the parsing bit in the code, but can't work out how to get my recipient value out:
-------------------------------

foreach(@field){
if ($_ eq $from_field_name){
$from = $FORM{$from_field_name} if $FORM{$from_field_name};
$message.="$_: " unless $send_just_data;
$message.="$FORM{$_}\n";
}
elsif ($_ eq $subject_field){$subject = $FORM{$subject_field} if $FORM{$subject_field};}
elsif ($_ eq $HTML_thankyou_field_name){$HTML_thankyou = $ThankYou{$FORM{$HTML_thankyou_field_name}} if $ThankYou{$FORM{$HTML_thankyou_field_name}};}
elsif ($_ eq $field_name_email){
if ($FORM{$field_name_email}){
@to = split(", ",$FORM{$field_name_email}) ;
my $i=0;
foreach(@to){$to[$i] = $SendTo{$_};$i++;}

}
}
else{
$message.="$_: " unless $send_just_data;
$message.="$FORM{$_}\n";
}
}
if ($REMOTE_ADDR){
$message.="REMOTE_ADDR: " unless $send_just_data;
$message.="$ENV{REMOTE_ADDR}\n";
}
if ($HTTP_USER_AGENT){
$message.="HTTP_USER_AGENT: " unless $send_just_data;
$message.="$ENV{HTTP_USER_AGENT}\n";
}
if ($DATE){
$message.="DATE: " unless $send_just_data;
$message.="$date[2]:$date[1]:$date[0] $date\n";
}

foreach(@to){male($_, $from, $subject, $message);}

print "Location: $HTML_thankyou\n\n";
exit;
----------------------------------------


Many thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top