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

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
e-mail to different addresses



Jan 22, 2001, 7:00 PM

Post #1 of 4 (479 views)
e-mail to different addresses Can't Post

I am trying to edit a cgi script so that a user can pick which person an e-mail is going to. Right now, I have MAIL "To: $recipient = 'email@address' the html page calls mail.cgi with a submit button; in the form data of the one I'm working on, I have:

<input name="person" type="radio" value="$recipient1"> Ginny

<input name="person" type="radio" value="$recipient2"> Bill

with $recipent1 being my e-mail address, and $recipient2 being Bill's e-mail address.

I am trying to call this up using:
MAIL "To: @recipient

with this being:

@recipient = (recipient1, $recipient2);
$recipient1 ='email address #1'
$recipient2 = 'email address #2'

I know I'm doing this wrong, because it's not working. So, how can I have a radio box on the html form next to the name of the person that a visitor wants to e-mail, which would then indicate in the script which e-mail address the letter should be sent to? I don't want the e-mail address to be visible in the html code; so I'm trying to do it in a cgi script.

Any help you can provide would be appreciated!


Jan 22, 2001, 7:08 PM

Post #2 of 4 (477 views)
Re: e-mail to different addresses [In reply to] Can't Post

Ok I see, well, change the values of your radio buttons to

1. 384
2. 875

And the name to "email'

Then in your cgi

print "Content-type: text/html\n\n";
use CGI qw:/standard/;
$Send_to = param('email');
if ($Send_to eq "384"){
$desiniation = '';
if ($Send_to eq "875"){
$desiniation = '';

open mail pipe and stuff
print mail "To: $desiniation";

That's the gist of how you can do it.



Jan 22, 2001, 10:22 PM

Post #3 of 4 (467 views)
Re: e-mail to different addresses [In reply to] Can't Post

Thank you very much!

While I didn't use exactly what you had suggested, it did set me on the right path. What I used in the html file:

<input name="email" type="radio" value="ginny">Ginny

<input name="email" type="radio" value="bill">Bill

in the cgi script:

if ($FORM{'email'} eq "ginny"){
$recipient = 'ginny@address';
if ($FORM{'email'} eq "bill"){
$recipient = 'bill@address';

It works great! Again, thank you!


Jan 22, 2001, 10:40 PM

Post #4 of 4 (465 views)
Re: e-mail to different addresses [In reply to] Can't Post

 I was hoping you would interpret what I said instead of copy, now I know you'll never ask the same question again :)



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

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