Specials | Announcements | Contact | Site Map
Willmaster.com
Hijack-proof forms. Surveys. List building.

Solid, safe website tools.

Whatever your need, Will Bontrager builds powerful software solutions.

Affiliate Cookie Setter
Search WillMaster.com:

WillMaster > Support > CGI Q&A

If you don't find the answer to your question in these archives, ask your CGI question at the Current Master Series CGI Forum.

ACTION = 2 CGI-generated mailtos, how to?

Author Message
19Sep06

VJ
Subject: ACTION = 2 CGI-generated mailtos, how to?

I have an HTML form with
--all of the information sometimes going to all of the recipients

--sometimes only half of the information going to only half the recipients

--sometimes both of these mailto conditions exist in the same form SUBMIT

It's determined by a Y/N selection on the form, but the Y/N condition exists for each "product," so Product 1 and 3 info can go to John, but only Product 2 info goes to to Jane, though sometimes both to John and jane.

I suppose needs parsed left and right in the perl script, but how? This obviously requires generating 2 different mail pages.

I'm flummoxed. Perl scripting not my strong suit. I know only how to generate and send one mail page from an HTML SUBMIT. Help please.

--VJ

19Sep06

Will
In response to: ACTION = 2 CGI-generated mailtos, how to?

If this doesn't help, post the URL of your test form. It would help me to visualize what you're working with.

How you would do it in Perl depends on the data being worked with.

Supposing the form has something like this:

Product 1:<br>
John -- <input type="radio" name="p1john" value="yes">Yes
        <input type="radio" name="p1john" value="no">No<br>
Jane -- <input type="radio" name="p1jane" value="yes">Yes
        <input type="radio" name="p1jane" value="no">No<br>
Product 2:<br>
John -- <input type="radio" name="p2john" value="yes">Yes
        <input type="radio" name="p2john" value="no">No<br>
Jane -- <input type="radio" name="p2jane" value="yes">Yes
        <input type="radio" name="p2jane" value="no">No<br>
Product 3:<br>
John -- <input type="radio" name="p3john" value="yes">Yes
        <input type="radio" name="p3john" value="no">No<br>
Jane -- <input type="radio" name="p3jane" value="yes">Yes
        <input type="radio" name="p3jane" value="no">No

Then the Perl code might be something like this:

sub SendP1email
{
     my $destination = shift;
# send product 1 email to destination
}

sub SendP2email
{
     my $destination = shift;
# send product 2 email to destination
}

sub SendP3email
{
     my $destination = shift;
# send product 3 email to destination
}

# Assuming form information is in hash %FORM
if($FORM{p1john} eq 'yes) { SendP1email('john@example.com'); }
if($FORM{p1jane} eq 'yes) { SendP1email('jane@example.com'); }
if($FORM{p2john} eq 'yes) { SendP2email('john@example.com'); }
if($FORM{p2jane} eq 'yes) { SendP2email('jane@example.com'); }
if($FORM{p3john} eq 'yes) { SendP3email('john@example.com'); }
if($FORM{p3jane} eq 'yes) { SendP3email('jane@example.com'); }

Will

20Sep06

VJ
In response to: ACTION = 2 CGI-generated mailtos, how to?

Thanks, Will, your strategy is porobably close, but I don't think it's that easy (unless I'm not fully appreciating what you're saying).

I know this has to be hard to visualize, but unfortunately this stuff is firewalled, soi I can't provide a URL

Let me add some specifics to give you better clues.

There's half a ton of name-value pairs. Who gets the stuff depends on some easily discriminated criteria, which I handle in IF ELSIF $RECIPIENT= perl fashion. And of course what's generated is managed by the conventional print MAIL " " command.

Simple enough. There's then one email generated (per se) and everyone who meets the criteria gets all of it.

Now, however, I've got a circumstance where all of the people might get all of the information, but also occasionally where some of the people are only going to part of it.

Essentially, then, I need a way to generate 2 very different emails: one where all of the info goes to RECIPIENT 1, and another mail to RECIPIENT 2 where some of the print MAIL instructions are ignored.

I don't see how I can get this done using that simplistic IF ELSIF $RECIPIENT = strategy I've got going now.

I think I need a change in strategy here (aka a lot more code), but need someone to share their vision (I'm not a coder--tho all I usually need is a push).

Still flummoxed. Help, please. (Thx again, Will . . . 2nd ideas?)

--VJ

21Sep06

Will
In response to: ACTION = 2 CGI-generated mailtos, how to?

Sorry, VC, but without understanding what you need, I can't help you.

How about putting the test form somewhere on the Internet where it can be accessed by a public browser?

Will