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

send mail script

Status
Not open for further replies.

stevanb

Technical User
Oct 4, 2002
58
US
I am looking for some help for a send mail script

What i need the script to do is to send the name and email off my web site BUT all the scripts that i have found either sends the mail and redirect to another page ie thank you or it refreshs the page

Is there a script that would send and the page it is on stay static no refresh or redirect

Thxs STeve
 
Just use the script that you like best, but change the <form...> part to:
<form target=&quot;_blank&quot;...>

It will open a new window to send the email and the one being used will not change. You can then change their script...Keep all the mail stuff in, but when you get to the redirect, or the thank you, take all that out and add this:

<html><body onLoad=&quot;self.close();&quot;>&nbsp;</body></html>

That way, the popup window will close as soon as the email sends

Rick -----------------------------------------------------------
 
To RISTMO

So the only way to do it is to use a popup window I was trying to do it off the main page without a popup but i seems it cannot be done without using a cgi script wish i have tried and tried to no avail

Thxs STeve
 
You might be misunderstanding RISTMO. If I understand what he's saying, you would still be doing it off the main page. The popup (or full-size thank you page) would just be a very temporary thing that closes as soon as it opens. The only thing you have to do is place onLoad=&quot;self.close();&quot; into the <body> tag of the thank you page. Placing target= &quot;_blank&quot; inside the <form> tag will make sure that your main page is left untouched, and then the thank you page will close as soon as it's opened, leaving the user at the main page still.

Does that help?
 
Here is what i changed it to and still errors

If this is wrong could you redo it for me

Thxs Steve

<form action=&quot; method=&quot;POST&quot;>
<input type=hidden name=&quot;to&quot; value=&quot;info@cruisewarehouse.cc&quot;>
<html><body onLoad=&quot;self.close();&quot;> </body></html>
target='<form target=&quot;_blank&quot;...>'>Name<input type='text' name='Name' value='' size='' maxlength=''><input type='submit' value='Submit'></form>
 
Something like this should work:

<form action=&quot; method=&quot;POST&quot; target=&quot;_blank&quot;>
<input type=hidden name=&quot;to&quot; value=&quot;info@cruisewarehouse.cc&quot;>
<input type=hidden name=&quot;redirect&quot; value=&quot;/thank_you.html&quot;>

Name: <input type='text' name='Name'>
<input type='submit' value='Submit'>
</form>

This assumes that the hidden field name that you need to use for the redirect page is called &quot;redirect&quot;. If the script instructions tell you to name it something else, then change it to whatever they want you to call it.

Then, create an html page and save it as &quot;thank_you.html&quot; and put it in the root directory.

Here's the code for the thank_you.html page:

<html>
<head>
<title>Disappearing Thank You Page</title>
</head>
<body onLoad=&quot;self.close()&quot;>
</body>
</html>

See if that works for you.
 
I don't know why that semi-colon was inserted in the form's action tag after I posted, but it shouldn't be there so remove that when you copy the code.

Also, after doing a search for the nmail.pl script in Google, it appears that the hidden field that this particular script uses for a redirect is called &quot;redir&quot;, so your code should be:

<input type=&quot;hidden&quot; name=&quot;redir&quot; value=&quot;/thank_you.html&quot;>

... instead of:

<input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/thank_you.html&quot;>

The &quot;thank_you.html&quot; page is a completely separate html page, not included in the main page code.
 
Well i tried what you said and no go it sends the mail but a popup comes up and it is a error

Here are the pages so you can see



I am striking out I thought designs were hard but for me that is the easy part

I tried a cgi script and that was a disaster

So i tried PHP well it seems to be not much easier


Thxs Steve
is my site i designed
 
Try this:

type_email.php
--------------------------------------------
<form action=&quot;send_email.php&quot;; method=&quot;POST&quot; target=&quot;_blank&quot;>
Name: <input type='text' name='Name'><input type='submit' value='Submit'>
</form>
--------------------------------------------

send_email.php
--------------------------------------------
<? mail(&quot;info@cruisewarehouse.cc&quot;,&quot;From: &quot; . $text); ?>
<html><body onload=&quot;self.close();&quot;>Thanks!</body></html>
--------------------------------------------

Rick -----------------------------------------------------------
 
I see a couple of problems.

For one thing, is the script on a different server or are you just calling it by it's ip address in one place and the domain name in another? You have the action tag pointing to:


but the domain that the form page and the thank you page are on is:


If the script is on a different server, then you must specify the entire url for the thank you page, such as:

<input type=&quot;hidden&quot; name=&quot;redir&quot; value=&quot;
Problem #2:

Here's the code that you have for your thank you page:

<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;><HTML><HEAD><META HTTP-EQUIV=&quot;Content-Type&quot; CONTENT=&quot;text/html; charset=ISO-8859-1&quot;><META NAME=&quot;Generator&quot; CONTENT=&quot;NetObjects Fusion MX for Windows&quot;><TITLE>Thank You</TITLE><html>
<head>
<title>Disappearing Thank You Page</title>
</head>
<body onLoad=&quot;self.close()&quot;>
</body>
</html><BASE TARGET=&quot;_parent&quot;><LINK REL=STYLESHEET TYPE=&quot;text/css&quot; HREF=&quot;./style.css&quot;><LINK REL=STYLESHEET TYPE=&quot;text/css&quot; HREF=&quot;./site.css&quot;><STYLE></STYLE></HEAD><BODY NOF=&quot;(MB=(ZeroMargins, 0, 41, 0, 2), L=(ThankYouLayout, 770, 420))&quot; STYLE=&quot;background-color: rgb(255,255,255); background-image: none;&quot; TOPMARGIN=0 LEFTMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0></BODY></HTML>

Not only is the code incorrect (more than one html tag, etc.), but you don't need all that for a blank page. Just delete all of that and replace it with what I posted earlier:

<html>
<head>
<title>Disappearing Thank You Page</title>
</head>
<body onLoad=&quot;self.close()&quot;>
</body>
</html>

By the way, why are these pages in frames?

. . and there's no php involved in any of this. :)
 
Oops! I saw type=&quot;text&quot; and thought that was name=&quot;text&quot;! Try this instead (and take out every ; that TT adds to the HTML, but not the PHP):

Try this:

type_email.php
--------------------------------------------
<form action=&quot;send_email.php&quot; method=&quot;POST&quot; target=&quot;_blank&quot;>
Name: <input type='text' name='name'><input type='submit' value='Submit'>
</form>
--------------------------------------------

send_email.php
--------------------------------------------
<? mail(&quot;info@cruisewarehouse.cc&quot;,&quot;From: &quot; . $name); ?>
<html><body onload=&quot;self.close();&quot;>Thanks!</body></html>
--------------------------------------------

Rick
P.S. As tnsbuff said, most of the code in your pages was not needed! Just the what we've given here. -----------------------------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top