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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can mailto automatically send and not open the window

Status
Not open for further replies.

niblet

Programmer
Aug 7, 2001
30
US


HI

I am working on a project and I need to mail the contents of a form, I am using the mailto and building the cc?subject&content and that works fine, but the mail doesn't send. It opens up into a window, for now I am forcing that with window.location = "themailstring" because I wanted to verify the content, however, now that i feel good about the content, I don't want the user to have to click send. I want the mail to just go. what do I need to do to make that happen. I am using java script ..
thanks in advance
niblet
 
Nope. Can't do it client side with JavaScript. You'll need to post that form to the server then process the form and send it through the servers SMTP services. Are you using hosting your own website or are you using an ISP ?

ToddWW
 
HI ToddWW,

Thanks for repsonding so quickly, I am using an ISP ..... does that make a big difference ?

niblet ...
 
Well, I can help you if your website is on an NT server. If it's on a UNIX box, I won't be much help.

Do you know ?

ToddWW
 
You can use a number of perl, php, or asp scripts to do the mailing on the server (per ToddWW's post). Some webmasters have even offered the use of a script on their server to process your forms... i will try and find a url for u. -gerrygerry
Go To
 
thanks gerrygerry and toddww, I look forward to seeing those scripts, I'll start looking on my own as well.

I have a cgi-bin.... can I do something with that ?
 


Update,

The home page of my provider says every package comes with
PHP 4.x, Perl, SSI, C/C++ ...

should I look for PHP scripts ?
thanks
niblet
 
javascript solution: thread216-193792 (but you/serfers will see the process of sending this mail & it might be interrupted)

about perl solution - try to seek for formmail.pl - most popular script on this subj.. just go to any search engine & start to search :)
 
PHP is definitely the way to go! it couldnt be easier! Here's a script to get you started:

form_processor.php
Code:
<?
$message  = &quot;Name: $name\n&quot;;
$message .= &quot;Age: $age\n&quot;; //appends age to name
if(mail(&quot;you@your-domain.com&quot;, &quot;Your Subject&quot;, &quot;$message&quot;))
 {
  //it sent ok, now thank them!
  header(&quot;Location: thank_you.htm&quot;); 
  exit;
 }

//there was an eror sending...
header(&quot;Location: error.htm&quot;);
?>
YourForm.htm
Code:
....
<form action=&quot;form_processor.php&quot; method=&quot;post&quot;>
 <input type=&quot;text&quot; name=&quot;name&quot;>
 <input type=&quot;text&quot; name=&quot;age&quot;>
 <input type=&quot;submit&quot; name=&quot;SEND!!&quot;>
</form>
....

When the form is submitted, the value of you &quot;name&quot; text box will be passed to php as a variable, $name. The value of your &quot;age&quot; text box will also be passed to php as a variable, $age.

All you have to do now is make a thank_you.htm and an error.htm. These pages will be displayed by the script based on the success or failure of the mailing process.

This code should all work assuming that your isp has sendmail - from the looks of the things they gave you, they will probably have it.

Formmail is good, it is written in perl, but I prefer to just make my own php script for form handling - its only a few lines of code! Plus this way you get more control over the format your email comes in. Formail requires a lot of hidden form fields in your webpage - i dont like to deal with all that.

I can email you a zip file with my listings above in actual files - you should be able to upload and run them &quot;right outta the box&quot;. I could help you modify these scripts though. Do you have any experience? Not a problem if u dont - its actually really easy. -gerrygerry
Go To
 
gerrygerry !!

thanks so much for the help ... i am not experienced at all in php ..... where, on my ISP server do I put the scripts, do they go in the cgi-bin ?

I am so glad you are willing to help me ..
my e-mail is nibleto@hotmail.com

niblet

 
Hi gerrygerry,

e-mail would be good if you can still help. I have a cc: line as well that needs to go on there.

I really appreciate your input. When I have it all figured out, I will come back here and post the final thing that works, so the problem will be solved for someone in the future....

niblet
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top