Lunarpages Web Hosting Forum

Scripting Languages Hosting Help => C++ / PERL / CGI Support => Topic started by: aqui_es1 on February 15, 2004, 02:57:23 PM

Title: TWebman's Custom email Scripts
Post by: aqui_es1 on February 15, 2004, 02:57:23 PM
Hi!  
First, I'd like to say that TWebman is a really great help to have created some automated processes for creating simple email scripts.

I'm very happy to see your help.

I want to use the simple email script for a form that just directs the user to a webpage.

My question is, is there anyway to have the user's correct email display to me when they submit the form?  Sometimes, they may not type their email address correctly in the fields we provide on our forms.

The second question is, in your custom scripts, the additional Fields you offer, how do they work with my Form?  Do I have to make them look like my form?

Third question is, I will have several forms on my website for customers to submit.  If I Save and name the script mailer.pl, how could I use my other forms with this one email script?  Would I need to create a different script for every form?

I think that's all I need to understand for now...

Thanks Again!  TWebman, you are a great asset to Lunarpages and for us! :yey:
Title: TWebman's Custom email Scripts
Post by: mark363 on February 15, 2004, 03:02:14 PM
Quote
My question is, is there anyway to have the user's correct email display to me when they submit the form? Sometimes, they may not type their email address correctly in the fields we provide on our forms.


No, you can't do that on any form. There's no way to find out somebody's e-mail address, so you'll have to trust them to type it correctly.

The other ?'s I'll leave for TWeb since I'm not very familiar with his scripts.
Title: TWebman's Custom email Scripts
Post by: aqui_es1 on February 15, 2004, 03:04:44 PM
Cool... the question you answered for me was the most important one.

Thanks and I'll wait for TWeb's replies.

Sincerely,
Erick
Title: TWebman's Custom email Scripts
Post by: TWebMan on February 15, 2004, 04:30:36 PM
1.  You can't 'capture' a person's email address, as mussavcom said.  My next version will feature a check so that at least it's a valid address.  Something similar to what's at the BYOF form.
If you go to http://twebman.lunarpages.com/perl/  and put in a faulty address.  it'll kick back anything without an @ and at least one dot (.).

2.  Not sure what you mean by 'look like' your form.  If you use one of the more advanced scriptmakers, you can grab the form itself either as a whole web page, or as an html table with the form in it, propely set to use that script.  You can then take that (either the form page or the form) and edit it however you like.  Just don't remove or add fields, and don't rename any.

2a. Remember some of these, depending which script you use, may require hidden fields for subject and/or redirect location.

2b. If you used the simple (BYOF) one, any form will do, as long as the action is set to the script, and the script is properly uploaded and chmoded to 755.  In that script, however, you NEED to have at least a hidden field called "L1" the value of which must be the url you want users sent to.

3.  You can point as many pages as you like to a single script.  If they are going to have different fields, make a BYOF script and point any forms you like to it.

I'm going to rework those script probably within the next month, and they'll have more options.  I'm also trying to make it simpler.  Any suggestions are welcome and will be considered (and probably implemented heheh).
Title: TWebman's Custom email Scripts
Post by: leighsww on February 15, 2004, 05:15:04 PM
Quote from: TWebMan
I'm going to rework those script probably within the next month, and they'll have more options.  I'm also trying to make it simpler.  Any suggestions are welcome and will be considered (and probably implemented heheh).


Suggestion 1: Make it automatically chmod to 755 and upload in ASCII!  :)

Suggestion 2: Make it NEVER issue an ERROR message for whatever reason!  :)

Suggestion 3: Make it come with it's own Guardian GURU, so we never have a form issue on this forum ever again!!  :)  

TWebMan - if you can make your script do those 3 things, I will worship you forever (and I know Ed will too!!)!!!  :love:
Title: TWebman's Custom email Scripts
Post by: TWebMan on February 15, 2004, 10:02:38 PM
Quote from: leighsww

Suggestion 1: Make it automatically chmod to 755 and upload in ASCII!  :)

Suggestion 2: Make it NEVER issue an ERROR message for whatever reason!  :)

Suggestion 3: Make it come with it's own Guardian GURU, so we never have a form issue on this forum ever again!!  :)  

TWebMan - if you can make your script do those 3 things, I will worship you forever (and I know Ed will too!!)!!!  :love:


1.  MAAAAAAXXXXXX!?!?!?!?!?!?!
2. Um.... MAAAAAAAXXXXXXXXX!?!?!?!?!?!?!?

3.  I'm here  :whip:

aqui_es, thanks for the comp, hope they work for you and anybody that uses them.  So, aqui, de donde es?  ;)
Title: TWebman's Custom email Scripts
Post by: leighsww on February 15, 2004, 10:48:14 PM
Quote from: TWebMan
3.  I'm here  :whip:


Yeah, but where were you when we needed you here?  :whip:

http://www.lunarforums.com/forum/viewtopic.php?t=8717&start=0

and here?  :whip:

http://www.lunarforums.com/forum/viewtopic.php?t=9056&start=0

We got their forms eventually working, but took us 7 - 8 pages worth of posts!

No more long vacations on the high seas for you!  From now on, you are the official Head-Honcho Forms GURU (Ed just got demoted)!!
Title: TWebman's Custom email Scripts
Post by: Ed on February 15, 2004, 11:00:15 PM
:cry:
Title: TWebman's Custom email Scripts
Post by: TWebMan on February 15, 2004, 11:40:20 PM
First of all, Ed, you rock ;)

Quote from: leighsww

Yeah, but where were you when we needed you here?  :whip:

http://www.lunarforums.com/forum/viewtopic.php?t=8717&start=0

and here?  :whip:

http://www.lunarforums.com/forum/viewtopic.php?t=9056&start=0

We got their forms eventually working, but took us 7 - 8 pages worth of posts!

No more long vacations on the high seas for you!  From now on, you are the official Head-Honcho Forms GURU (Ed just got demoted)!!


Where was I?  If only you knew...  :o

Anyway, I didn't need to be here.  I see you guys got the nice newbies all straightened out.

Also, whenever I see a post with an entire (what is it, like 30K?) FormMail script pasted into the body, I can only have one reply...

(http://twebman.lunarpages.com/files/postcliffnotes.jpg)
Title: TWebman's Custom email Scripts
Post by: aqui_es1 on February 16, 2004, 02:10:22 AM
Quote from: TWebMan
Quote from: leighsww

Suggestion 1: Make it automatically chmod to 755 and upload in ASCII!  :)

Suggestion 2: Make it NEVER issue an ERROR message for whatever reason!  :)

Suggestion 3: Make it come with it's own Guardian GURU, so we never have a form issue on this forum ever again!!  :)  

TWebMan - if you can make your script do those 3 things, I will worship you forever (and I know Ed will too!!)!!!  :love:


1.  MAAAAAAXXXXXX!?!?!?!?!?!?!
2. Um.... MAAAAAAAXXXXXXXXX!?!?!?!?!?!?!?

3.  I'm here  :whip:

aqui_es, thanks for the comp, hope they work for you and anybody that uses them.  So, aqui, de donde es?  ;)


Hey TWebMan,

I'm from Guate and grew up in the States...now I'm chillin' in the Big Red...(China ) 8-)

I'll check out the links to the other threads that were given by leighsww.  I'm still a bit confused when using multiple forms though.

Eventually, certain forms would be going to different email addresses, not just one address and not just all email addresses one can point indentify in the email script.

How can I assign a script to a form or two, to go to a one particular email address only while having other forms on the website, being sent to other email addresses.

I'm just trying to balance the workload for proccessing the forms from the site.

Xiexie...means Gracias and Thanks in Chinese  :thumb:
Title: TWebman's Custom email Scripts
Post by: TWebMan on February 16, 2004, 09:50:48 AM
Ah, ok.  Well, the recipient email is hard-coded into the script, and that must remain, because that is one of the main security features of the script, keeping spammers from hijacking it like they do FormMail.

So, yes, if the email containing form field values is going to a different email, that would require a different script.  A different script for each recipient, but any forms that are to send to the same email, can use the same script.

Chillin in China, eh?  Cool.  Gotta make it over that way one day soon :)
Title: TWebman's Custom email Scripts
Post by: leighsww on February 16, 2004, 12:07:32 PM
Quote from: aqui_es1
I'll check out the links to the other threads that were given by leighsww.  I'm still a bit confused when using multiple forms though.

Eventually, certain forms would be going to different email addresses, not just one address and not just all email addresses one can point indentify in the email script.

How can I assign a script to a form or two, to go to a one particular email address only while having other forms on the website, being sent to other email addresses.


aqui_es1 - those other threads may really confuse you because they are super looooong.  If TWebMan's script doesn't do what you need (be able to assign different forms to be emailed to different recipients) then you may want to try the bnbform.cgi script.

You basically configure the "recipient" hidden tag in the hmtl form to a specific email addy.  So, each form can have a different recipient.

Am I reading your post correctly and is this what you are needing?

If it is, then go to bignosebird's site and download the script.  Here's the URL:

http://bignosebird.com/carchive/bnbform.shtml

Then follow the instructions, and if you run into problems, post here and I'll help you.

One last thing, on the bignosebird site there is a sample to see the script in action where he has two recipients in the form where you can click on to select which recipient you want to send the form results to.  Well, if you are only wanting the form sent to only "one" recipient automatically (where the customer doesn't have to select who to send to,) you can just assign the recipient's email addy in the form itself as a hidden tag.

Just thought I'd mention that in case you thought you had to have them check mark the recipient even if you only will be having one (and not two) recipients.  Anyway, once you read the documentation for the script you will get an idea of what you want to use.
Title: TWebman's Custom email Scripts
Post by: leighsww on February 16, 2004, 12:10:22 PM
Quote from: Kata
:cry:


But, Ed, you yourself said that you didn't want the job!!  I was only doing you a favor by demoting you!  Believe me!!  :love:
Title: TWebman's Custom email Scripts
Post by: leighsww on February 16, 2004, 12:17:42 PM
Quote from: TWebMan
Also, whenever I see a post with an entire (what is it, like 30K?) FormMail script pasted into the body, I can only have one reply...


LOL!  :)   Well, unfortunately sometimes we ask them to post their script because they have things configured wrong inside it (like the path to perl, or once one person forgot to change the script to reflect their domain name and left it as "http://yourdomain.com", etc.)

So, sometimes that's the first place to look when their form is not working (might cut down a few pages to the thread if we can spot that right off :) )
Title: TWebman's Custom email Scripts
Post by: TWebMan on February 16, 2004, 01:28:16 PM
Yeah, I know.  Just wanted to use that pic ;)
Title: TWebman's Custom email Scripts
Post by: leighsww on February 16, 2004, 04:19:31 PM
Okay, I just read the following thread regarding the cgi scripts, so hang on to your horses aqui_es1 before setting this up:

http://www.lunarforums.com/forum/viewtopic.php?t=11973

It seems that now any cgi, pl or php script extension can't be used for forms.  Maybe you should ask Danielle/Miraenda what script she's using as she has offered a replacement solution for chemic2.
Title: TWebman's Custom email Scripts
Post by: aqui_es1 on February 16, 2004, 05:31:31 PM
Quote from: leighsww
Quote from: aqui_es1
I'll check out the links to the other threads that were given by leighsww.  I'm still a bit confused when using multiple forms though.

Eventually, certain forms would be going to different email addresses, not just one address and not just all email addresses one can point indentify in the email script.

How can I assign a script to a form or two, to go to a one particular email address only while having other forms on the website, being sent to other email addresses.


aqui_es1 - those other threads may really confuse you because they are super looooong.  If TWebMan's script doesn't do what you need (be able to assign different forms to be emailed to different recipients) then you may want to try the bnbform.cgi script.

You basically configure the "recipient" hidden tag in the hmtl form to a specific email addy.  So, each form can have a different recipient.

Am I reading your post correctly and is this what you are needing?

If it is, then go to bignosebird's site and download the script.  Here's the URL:

http://bignosebird.com/carchive/bnbform.shtml

Then follow the instructions, and if you run into problems, post here and I'll help you.

One last thing, on the bignosebird site there is a sample to see the script in action where he has two recipients in the form where you can click on to select which recipient you want to send the form results to.  Well, if you are only wanting the form sent to only "one" recipient automatically (where the customer doesn't have to select who to send to,) you can just assign the recipient's email addy in the form itself as a hidden tag.

Just thought I'd mention that in case you thought you had to have them check mark the recipient even if you only will be having one (and not two) recipients.  Anyway, once you read the documentation for the script you will get an idea of what you want to use.


Hi,
So can the script just be set up to send a couple of forms to a specific email address without having the Customer select where to send it to?  Most times, the customer won't know which email would be appropriate and I'd hate to burden them to make a choice, so to make the "customer experience" pleasant, I would like to set that up on the back-end so the customer would just click the "submit" button and they're done.

Thanks for all your help!  :yey:
Title: TWebman's Custom email Scripts
Post by: TWebMan on February 16, 2004, 06:26:23 PM
aqui_es, just want you to know that part of FormMail's vulnerablility is the variable recipient.

I know that's what you're trying to accomplish, but it doesn't have to be set as a variable before the post hits the script.

The script can easily select a recipient depending on the value of another field.

first of all what determines where the email goes?  Is there a 'subject' or 'purpose of message' menu they select from?

How many different possible recipients are there?

I can make something out of my script that will allow this, and still be secure as any recipient will be still hardcoded into the script.  Just let me know.
Title: TWebman's Custom email Scripts
Post by: leighsww on February 16, 2004, 07:51:12 PM
Quote from: aqui_es1
So can the script just be set up to send a couple of forms to a specific email address without having the Customer select where to send it to?


Yes, it would have, but just today there was an email that LP sent that said that the bnbform.cgi script can't be used anymore on their servers (I just received this email a few minutes ago).  So, basically, you have to scrap using this form script, now.

I, too, have to go now and change some of my forms that I still have using the bnbform.cgi to something else (other forms I have had Scanman20 convert to PHP for me).

Anyway, since we both now seem to be needing the same capability of different forms going to different recipients, let's see what TWebMan can do for us with what he said in his above post.

TWebMan - HELP!!  :love:

Basically, for what I configured for my sister's site, here's examples:

"Products Form" sends results to "products@domain.com"
"Auditions Form" sends to "auditions@domain.com"
"Tickets Form" sends to "tickets@domain.com"

etc.

Each form needs to have the recipient correlating to the form that is being filled so that it is forwarded to the particular person taking care of that department.
Title: TWebman's Custom email Scripts
Post by: aqui_es1 on February 16, 2004, 11:20:15 PM
Yes!  This is exactly what I would need to do.   So, we'll wait for TWeb's replies?

I hope we can have something coming soon.

Sincerely,
aqui_es1
Title: TWebman's Custom email Scripts
Post by: TWebMan on February 17, 2004, 02:58:32 AM
Quote from: leighsww

"Products Form" sends results to "products@domain.com"
"Auditions Form" sends to "auditions@domain.com"
"Tickets Form" sends to "tickets@domain.com"

etc.....

"etc"    Second largest word in the language, besides "if".   :)

How many addresses?  Is it like 10, or like 100?  1000?  That's the first concern.

In the example above, the fom would have a drop menu, with those items:

"Products Form"
"Auditions Form"
"Tickets Form"

The script will then select from its own little list of recipients based on what it sees coming in from that drop menu.

The list you posted there, leighsww,  is exactly what I would need, but a real one of course, letting me know which selection needs to send where.  Just send it through my twebman home page (there's a form there) or PM me with it, however you like.

Same with you, aqui_es.  You guys have just given me an idea for a good enhancement that may cure this same dilema for many folks :)

If it is like hundreds of possible recipients, then we'd have to get a db involved, though I do like as much as possible to keep the recipients in the script.  That way the recipient never need come from an external source, and the script knows that, so it helps keep it secure from those bad, bad spammers!

BAD spammers!  :whip:
Title: TWebman's Custom email Scripts
Post by: leighsww on February 17, 2004, 11:02:49 AM
Quote from: TWebMan
"etc"    Second largest word in the language, besides "if".   :)


LOL!  Sorry, wasn't sure if exacts were needed in case we were going to need to add those ourselves to your script when you revised it.

Actually, I've already got the forms fixed last night as I had to get this done right away, so I'm all squared away for now.  Thanks, anyway!  :P
Title: TWebman's Custom email Scripts
Post by: TWebMan on February 17, 2004, 11:30:39 AM
Good deal :)  We'll see if aqui_es1 needs any help.  Let me know  :thumb:
Title: TWebman's Custom email Scripts
Post by: aqui_es1 on February 17, 2004, 04:59:40 PM
Quote from: TWebMan
Good deal :)  We'll see if aqui_es1 needs any help.  Let me know  :thumb:


Of course I would need some help  8-)

I would probably have about 2-3 seperate recepients each getting about 2 forms each.

I have a twister for you though, and don't have a heart attack, but some of the forms will be in Chinese  :shock:

Do you think that by naming the properties of the filed, button, etc. with an English name, would help the script identify the fileds and buttons?

The the text placed on the form itself  be in Chinese of course.

Whatta you think?
Title: TWebman's Custom email Scripts
Post by: shadowbane on February 17, 2004, 05:59:19 PM
As an alternative to having the destination email address completely hardcoded in the script, how about having a list of possible email addresses in the script, and have the form specify something like destinationemail=1, then just use entry 1 from the array.

Also,

If the form is in a password protected directory
and If their email address is on your site
and if the directory-username matches their email address

you should be able to grab their user name from an environment variable to keep them from needing to enter it.  But thats a lot of ifs...  it would go something like this in PHP (of course I havent tested this, and my PHP is a little rusty):

Code: [Select]

<input name="YourEmail" type="text" value="<? echo $REMOTE_USER ?>@example.com" size="40">
Title: TWebman's Custom email Scripts
Post by: shadowbane on February 17, 2004, 06:36:07 PM
Im great at replying to myself... :D

another option:  The recipient domain could be hard coded and the dynamic portion could be heavily filtered..   ie:

perl:
Code: [Select]
recipient =~ /[^a-zA-Z0-9_]//g;
recipient .= '@example.com';


thus recipient="accounting" results in an email to accounting@example.com
and recipient="casualjoe@spamvictim.com" results in an email to casualjoespamvictimcom@example.com

That would limit spammers to the site with the form.
Title: TWebman's Custom email Scripts
Post by: TWebMan on February 17, 2004, 08:41:00 PM
Two or three recipients?  That's it?

Why did I guess there might be an Oriental flavor to this?  I just had some sautéed gator.  It wasn't very good.  But my friend's fried gator was great!  Do they eat that over there?

Anyway, shadowbane, looks like some good solutions there.  He only has two possible recipients though, so I'd just do a couple of if's depending on a drop menu they'd select, just plugging in one of the possible recipient addies depending on the value of the drop menu.

aqui_es1, if you like, PM me with the recipients, and some matching value for each that the user would select out of a menu that would determine who they would go to.
Title: TWebman's Custom email Scripts
Post by: aqui_es1 on February 18, 2004, 05:48:50 AM
Ok TWebMan,

I'll PM u as soon as I get the details.  Would the Chinese text in the form affect the script at all?  Would the option of naming the fields' properties in English help?

As for the Gator meat, here in the South the locals joke when they say "we eat anything that flies, except an airplane and anything with four legs, except a table"   :)

Thanks -
Title: TWebman's Custom email Scripts
Post by: aqui_es1 on February 20, 2004, 07:23:18 PM
Quote from: TWebMan
Ah, ok.  Well, the recipient email is hard-coded into the script, and that must remain, because that is one of the main security features of the script, keeping spammers from hijacking it like they do FormMail.

So, yes, if the email containing form field values is going to a different email, that would require a different script.  A different script for each recipient, but any forms that are to send to the same email, can use the same script.

Chillin in China, eh?  Cool.  Gotta make it over that way one day soon :)


Hey TWebMan,

If I could use different scripts, which would proabably be the best and quickest solution for now, how could i accomplish this?  

Would it be as simple as configuring the forms to a particular script and then save the script using different file names?

This is what was puzzling me at first, because the tutorials for cgimail want you to name the one script file a particular way and doesn't mention anything about having multiple mail scripts handling different forms.

If I can get this up and running this way, later we can look at customizing and simplifying the process using only one script.

Since some forms will have some Chinese flavor to them
 :thumb: , I noticed in a sample script an entry like this: $charset           = 'iso-8859-1';

Would I have to code these scripts to read Chinese Characters (Big5) so the output would be in Chinese?  This is what I want to happen.

let me know ok bud...
Title: TWebman's Custom email Scripts
Post by: TWebMan on February 20, 2004, 08:59:41 PM
Yeah, you could do what you are describing here, with different file names.

Pulling recipients out of an array still requires a variable for the recipient.

Again, I know that hard-coding the recip right into the sendmail command is the most secure.  Anything outside of that means that what will be in that sendmail command is a variable, and though there are ways to protect it, seems to me the best way is not to have a variable to protect at all.   Not in a scripting language like perl, anyway.

aqui_es1, if it's just a handful of recipients, it's not that difficult to code them into one script.  If you have a lot, you could always share the load amongst a couple of them or a few.
Title: TWebman's Custom email Scripts
Post by: aqui_es1 on February 23, 2004, 08:07:22 PM
Hi TWebMan,

I PM'd you the other day but no response...is it working?

Anyhow, I just had a question.  The solution of having several scripts with different file names would be the best solution for now.  We can customize one script later to handle multiple recepients receiving multiple/selected forms.

Would I just download the basic scripts you have on your website?  

I would need help with how to do what you mention "Pulling recipients out of an arry".
Title: TWebman's Custom email Scripts
Post by: Ed on February 23, 2004, 08:09:00 PM
Tweb is a pretty busy guy :-) I"m pretty sure he will be by soon enough to receive your PM. Hes here for a bit then away for a bit and then back again :-)

- Ed
Title: TWebman's Custom email Scripts
Post by: TWebMan on February 24, 2004, 10:59:06 AM
Haven't been here in a day or two.  It happens ;)

I responded, aqui_es1.
Title: TWebman's Custom email Scripts
Post by: aqui_es1 on February 26, 2004, 07:22:18 AM
got it...I'll PM your messages
Title: TWebman's Custom email Scripts
Post by: Danielle on February 26, 2004, 07:23:22 AM
Gah, you mean he doesn't live here like the rest of us. Shame on him.   :P
Title: TWebman's Custom email Scripts
Post by: TWebMan on February 26, 2004, 07:37:55 AM
I don't have to.  When I can't make it around, I know my eViL TwiN will cover for me :)