Email form not sending emails?

hey all, I have set up an email form but it is not sending the data to an email. all it does is open up a new window with the data in it like I clicked on an email link.

Here is the code I am using for my email form.

<form id="form_164168" class="appnitro" METHOD=POST ACTION="" ENCTYPE="text/plain">
					<div class="form_description">
			<h2>Apply Online</h2>
			<ul >
					<li id="li_1" >
		<label class="description" for="element_1">Name </label>
		<span style="width: 129px">
			<input id="element_1_1" name= "element_1_1" class="element text" maxlength="255" size="8" value="" style="width: 109px"/>
			<input id="element_1_2" name= "element_1_2" class="element text" maxlength="255" size="14" value="" style="width: 121px"/>
		</li>		<li id="li_2" >
		<label class="description" for="element_2">Email </label>
			<input id="element_2" name="element_2" class="element text medium" type="text" maxlength="255" value=""/> 
		</li>		<li id="li_11" >
		<label class="description" for="element_3">Phone </label>
		<span style="width: 70px">
			<input id="element_3_4" name="element_3_4" class="element text" size="3" maxlength="3" value="" type="text" style="width: 52px"> -
			<label for="element_3_4">(###)</label>
		<span style="width: 77px">
			<input id="element_3_5" name="element_3_5" class="element text" size="3" maxlength="3" value="" type="text" style="width: 61px"> -
			<label for="element_3_5">###</label>
		<span style="width: 101px">

			<input id="element_3_6" name="element_3_6" class="element text" size="4" maxlength="4" value="" type="text" style="width: 98px">
			<label for="element_3_6">####</label>
		</li>		<li id="li_9" >
		<label class="description" for="element_9">Position Applying For </label>
		<select class="element select medium" id="element_9" name="element_9"> 
			<option value="" selected="selected"></option>
<option value="1" >First option</option>
<option value="2" >internet engineers</option>
<option value="3" >Second option</option>
<option value="4" >Third option</option>

		</li>		<li id="li_4" >
					<li id="li_4" >
					<label class="description" for="element_4">Upload Your 
					<li id="li_4" class="style6" >
					Must be in .doc, .rtf, .txt or .pdf format<br>  
					<li id="li_4" >
			<input id="element_4" name="element_4" class="element file" type="file"/> 
		</li>		<li id="li_10" >
		<label class="description" for="element_10">Your Credit Score </label>
			<input id="element_10" name="element_10" class="element text medium" type="text" maxlength="255" value=""/>
			<h3 class="style7">Your application will not be accepted and marked 
			as incomplete without your real credit score. To obtain your credit 
			score free Click on the banner below.</h3>
			<h3 class="style7"><img alt="" height="27" src="credit.png" width="288"></h3>
		</li>		<li id="li_8" >
		<label class="description" for="element_8">Notes </label>
			<textarea id="element_8" name="element_8" class="element textarea medium" cols="20" rows="1"></textarea> 
					<li class="buttons">
			    <input type="hidden" name="form_id" value="164168" />
				<input id="saveForm" class="button_text" type="submit" name="submit" value="Send" />

If anyone could give me a heads up on what I am doing wrong I would very much appreciate it.


Using the forms action attribute like that is not a very reliable method as I understand it, but what you are describing IS how that works.
If you are wanting to send the email behind-the-scenes when you submit the form then you will need to a server-side language like PHP to take that form data and send an email.

Could you point me in the right direction on where I can learn how to do that?

Hi David,

here is a free script that does the job, it also includes a nifty spam filter. you will need to play with it to fit your form, let us know how you get on

I went to that url and edited the script.

When I click on submit I get the “Your mail was successfully sent.”

But I never receive the email.


After doing some research it seems the host doesnt have PHP mail() enabled.

Nevermind it still isnt sending.

I was able to send mail using this test code

mail('','Test mail','The mail function is working!');
echo 'Mail sent!';

But when I use my code the email isnt being sent.

Here is my code


$yourEmail = ""; // the email address you wish to receive these mails through
$yourWebsite = "Addback Solutions"; // the name of your website
$maxPoints = 4; // max points a person can hit before it refuses to submit - recommend 4

function isBot() {
	$bots = array("Indy", "Blaiz", "Java", "libwww-perl", "Python", "OutfoxBot", "User-Agent", "PycURL", "AlphaServer", "T8Abot", "Syntryx", "WinHttp", "WebBandit", "nicebot");
	$isBot = false;
	foreach ($bots as $bot)
	if (strpos($_SERVER['HTTP_USER_AGENT'], $bot) !== false)
		$isBot = true;

	if (empty($_SERVER['HTTP_USER_AGENT']) || $_SERVER['HTTP_USER_AGENT'] == " ")
		$isBot = true;
	return $isBot;

	if (isBot())
		exit("Bots not allowed.</p>");

	function clean($data) {
		$data = trim(stripslashes(strip_tags($data)));
		return $data;
	// lets check a few things - not enough to trigger an error on their own, but worth assigning a spam score.. 
	// score quickly adds up therefore allowing genuine users with 'accidental' score through but cutting out real spam :)
	$points = (int)0;
	$badwords = array("adult", "beastial", "bestial", "blowjob", "clit", "cum", "cunilingus", "cunillingus", "cunnilingus", "****", "ejaculate", "fag", "felatio", "fellatio", "****", "fuk", "fuks", "gangbang", "gangbanged", "gangbangs", "hotsex", "hardcode", "jism", "jiz", "orgasim", "orgasims", "orgasm", "orgasms", "phonesex", "phuk", "phuq", "porn", "pussies", "pussy", "spunk", "xxx", "viagra", "phentermine", "tramadol", "adipex", "advai", "alprazolam", "ambien", "ambian", "amoxicillin", "antivert", "blackjack", "backgammon", "texas", "holdem", "poker", "carisoprodol", "ciara", "ciprofloxacin", "debt", "dating", "porn", "link=", "voyeur");
	$exploits = array("content-type", "bcc:", "cc:", "document.cookie", "onclick", "onload", "javascript");

	foreach ($badwords as $word)
		if (strpos($_POST['comments'], $word) !== false)
			$points += 2;
	foreach ($exploits as $exploit)
		if (strpos($_POST['comments'], $exploit) !== false)
			$points += 2;
	if (strpos($_POST['comments'], "http://") === true || strpos($_POST['comments'], "www.") === true)
		$points += 2;
	if (isset($_POST['nojs']))
		$points += 1;
	if (preg_match("/(<.*>)/i", $_POST['comments']))
		$points += 2;
	if (strlen($_POST['name']) < 3)
		$points += 1;
	if (strlen($_POST['comments']) < 15 || strlen($_POST['comments'] > 1500))
		$points += 2;
	// end score assignments

	if (empty($_POST['name']) || empty($_POST['email']) || empty($_POST['comments'])) {
		$error_msg .= "Name, e-mail and comments are required fields. \
	} elseif (strlen($_POST['name']) > 15) {
		$error_msg .= "The name field is limited at 15 characters. Your first name or nickname will do! \
	} elseif (!ereg("^[A-Za-z' -]*$", $_POST['name'])) {
		$error_msg .= "The name field must not contain special characters. \
	} elseif (!ereg("^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,6})$",strtolower($_POST['email']))) {
		$error_msg .= "That is not a valid e-mail address. \
	} elseif (!empty($_POST['url']) && !preg_match('/^(http|https):\\/\\/(([A-Z0-9][A-Z0-9_-]*)(\\.[A-Z0-9][A-Z0-9_-]*)+)(:(\\d+))?\\/?/i', $_POST['url']))
		$error_msg .= "Invalid website url.";
	if ($error_msg == NULL && $points <= $maxPoints) {
		$subject = "Automatic Form Email";

		$message = "You received this e-mail message through your website: \
		foreach ($_POST as $key => $val) {
			$message .= ucwords($key) . ": $val \\r\
		$message .= 'IP: '.$_SERVER['REMOTE_ADDR']."\\r\
		$message .= 'Browser: '.$_SERVER['HTTP_USER_AGENT']."\\r\
		$message .= 'Points: '.$points;

		if (strstr($_SERVER['SERVER_SOFTWARE'], "Win")) {
			$headers   = "From: $yourEmail \\r\
			$headers  .= "Reply-To: {$_POST['email']}";
		} else {
			$headers   = "From: $yourWebsite <$yourEmail> \\r\
			$headers  .= "Reply-To: {$_POST['email']}";

		if (mail($yourEmail,$subject,$message,$headers)) {
			echo '<p>Your mail was successfully sent.</p>';
		} else {
			echo '<p>Your mail could not be sent this time.</p>';
function get_data($var) {
	if (isset($_POST[$var]))
		echo htmlspecialchars($_POST[$var]);
if ($error_msg != NULL) {
	echo '<p><strong style="color: red;">ERROR:</strong><br />';
	echo nl2br($error_msg) . "</p>";

<form action="apply.php" method="post" ENCTYPE="multipart/form-data">
		<p><input type="hidden" name="nojs" id="nojs" /></p>
	<label for="name">Name:</label><br /> 
		<input type="text" name="name" id="name" value="<?php get_data("name"); ?>" size="30"/></p>
	<label for="email">E-mail:</label> <br />
		<input type="text" name="email" id="email" value="<?php get_data("email"); ?>" size="30" /><br />
	<label for="name">Number:</label> <br />
		<input type="text" name="number" id="number" value="<?php get_data("number"); ?>" /></p>
	<label for="url">Position you are applying for:</label><br /> 
		<select name="position" id="position" >
      <option selected="selected">accounting+finance</option>
      <option>admin / office</option>
      <option>arch / engineering</option>
      <option>art / media / design</option>
      <option>biotech / science</option>
      <option>business / mgmt</option>
      <option>customer service</option>
      <option>food / bev / hosp</option>
      <option>general labor</option>
      <option>human resources</option>
      <option>internet engineers</option>
      <option>legal / paralegal</option>
      <option>marketing / pr / ad</option>
      <option>medical / health</option>
      <option>nonprofit sector</option>
      <option>real estate</option>
      <option>retail / wholesale</option>
      <option>sales / biz dev</option>
      <option>salon / spa / fitness</option>
      <option>skilled trade / craft</option>
      <option>software / qa / dba</option>
      <option>systems / network</option>
      <option>technical support</option>
      <option>tv / film / video</option>
      <option>web / info design</option>
      <option>writing / editing</option>
	<label for="location">Upload your resume:</label><br />
	<span class="style1">(Must be in .doc, .rtf, .txt or 
	.pdf format)</span><br />
		<input type="file" name="upload" size="30"/><br />
	<label for="name">Credit Score:</label> <br />
		<input type="text" name="score" id="score" value="<?php get_data("score"); ?>" size="30"/></p>
	<h3 class="style2" style="width: 224px">Your application will not be 
	accepted and marked as incomplete without your real credit score. To obtain 
	your credit score free Click on the banner below.</h3>
	<img alt="" height="27" src="credit.png" width="288" /></p>

	<label for="comments">Comments:</label><br />
		<textarea name="comments" id="comments" rows="5" cols="20"><?php get_data("comments"); ?></textarea><br />
	<input type="submit" name="submit" id="submit" value="Send" />

I am really confused so any help would be appreciated.

Couldnt edit the post, But I got it all working except it isnt attaching the upload file to the email.


You will have a better chance of finding the right answer if you post in the PHP forum.

Yes, file upload is a different animal altogether. I would recommend just letting people post a comment etc, and let them email you files later when you’ve established a relationship.

Anyway, as Mark says, this is a job for the PHP forum.

Since you don’t have PHP enabled on your server your only chance is to use a remotely hosted service like 123ContactForm. They will process your contact form and send you the whole content by email.

i appreciate the reply, but this thread was made 3 months ago. I have since fixed the problem

Well, now you’ve piqued my interest:
what did you end up doing?