cgi forms for email

  • jlknauff
  • Expert
  • Expert
  • User avatar
  • Posts: 502
  • Loc: Florida

Post 3+ Months Ago

Maybe someone here can help me with something. I have a form on my site that sends an email to one of our accounts but there are a few things that I would like it to do that it doesn't and I don't know how to make it do what I want. The form is located at

http://www.vsssleep.com/form.htm

Problems:

1. How can I make the persons email address populate the from field on the email that is sent to us?

2. Can I use a CGI script to auto respond to their email telling them that we received their request and yada yada yada?

Keep in mind guys-I know next to nothing about CGI. Any help is appreciated[/url]
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23455
  • Loc: Woodbridge VA

Post 3+ Months Ago

I would recommend looking into Matt's formmail script. It does exactly what you're asking and is very easy to follow the instructions and modify:

http://www.scriptarchive.com/formmail.html

Here is the readme so you can see what it's all about:
http://www.scriptarchive.com/readme/formmail.html

I've been using it for almost 3 years now, and can get this script to do almost anything I want and I don't even know how to program in Perl.

Also it's free.
  • jlknauff
  • Expert
  • Expert
  • User avatar
  • Posts: 502
  • Loc: Florida

Post 3+ Months Ago

thanks
  • Carnix
  • Guru
  • Guru
  • User avatar
  • Posts: 1098

Post 3+ Months Ago

jlknauff wrote:
Maybe someone here can help me with something. I have a form on my site that sends an email to one of our accounts but there are a few things that I would like it to do that it doesn't and I don't know how to make it do what I want. The form is located at

http://www.vsssleep.com/form.htm

Problems:

1. How can I make the persons email address populate the from field on the email that is sent to us?

2. Can I use a CGI script to auto respond to their email telling them that we received their request and yada yada yada?

Keep in mind guys-I know next to nothing about CGI. Any help is appreciated[/url]


1. This is an output question... all scripts of this nature will compile the e-mail headers, you just have to make sure the peices you want are placed right.

2. Short Answer: Yes. usually it involves running the send mail routine more than once.


I'll not get more detailed than that. ATNO/TW's links have some really good info.

One tip though... I took a look at your form's source and noticed that the recipient e-mail (that is, the address where the form data is being e-mailed) is listed as a hidden field. That's probably not a good idea... generally it also not good for the redirect URL to be in the form either. There are some lower level security issues (like a spambot crawling your site and harvesting your info e-mail) but mostly it's just not good practice. Mostly, it's a matter of more bandwidth being used in the transmission than needed (you shouldn't pass variables you don't need to use).

.c
  • jlknauff
  • Expert
  • Expert
  • User avatar
  • Posts: 502
  • Loc: Florida

Post 3+ Months Ago

I looked through the links and got one problem fixed but I still can't figure out how to configure an "autoresponder" type of thing from the form. Also, Carnix mentioned not having the recipient in the form-how do I do that?
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23455
  • Loc: Woodbridge VA

Post 3+ Months Ago

I've never done the auto-responder part from the form or script itself. I just set the email account that reseives the message to autorespond with a predetermined reply. Most emails accounts should have an option to autorespond.
  • Carnix
  • Guru
  • Guru
  • User avatar
  • Posts: 1098

Post 3+ Months Ago

jlknauff wrote:
I looked through the links and got one problem fixed but I still can't figure out how to configure an "autoresponder" type of thing from the form. Also, Carnix mentioned not having the recipient in the form-how do I do that?


In general, you would use a loop to run the e-mail routine twice. I tend to write scrips with bunch of functions, and little in the way of runtime-cope, other than any global variables that might need to be declared (there are usually very few global-scope variables in my code). Those functions I use over and over across scrips as custom PMs (if I'm doing something with Perl), or as includes/requireds, etc. Having a single function library makes it WAY easier... so... that said, I would do it in Perl something like this:

Code: [ Select ]
$x=0
while($x<1){
 if($x == 0){
   [populate your variables for the e-mail to your info group]
 }
 elsif($x == 1){
   [populate variables for the autoresponder]
}

 $cmd = &do_email($to,$from,$subject,$replyto,$x);
 $x++;
}

sub do_email{
 ($to,$from,$subject,$replyto,$x) = @ARGV;
 $result = [email engine code here]
 return $result;
}
  1. $x=0
  2. while($x<1){
  3.  if($x == 0){
  4.    [populate your variables for the e-mail to your info group]
  5.  }
  6.  elsif($x == 1){
  7.    [populate variables for the autoresponder]
  8. }
  9.  $cmd = &do_email($to,$from,$subject,$replyto,$x);
  10.  $x++;
  11. }
  12. sub do_email{
  13.  ($to,$from,$subject,$replyto,$x) = @ARGV;
  14.  $result = [email engine code here]
  15.  return $result;
  16. }

Post Information

  • Total Posts in this topic: 7 posts
  • Users browsing this forum: No registered users and 116 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.