Jump to content

Recommended Posts

It's a form that people will fill out. Anyway, it worked for a while, but now it's suddenly stopped sending the email to me. I don't know what I changed. When a person submits it, it gives the "thank you" message as though it did indeed send it without problems, but I'm not getting the email (and they're not showing up in my spam folders either).

 

Please help?  ???

 

<script type="text/javascript">

function ValidateName()
{
	if ( document.getElementById( "name" ).value !="" )
	{
		document.getElementById('errormessage').innerHTML  = "";
		return true;	
	}else
	{	
		document.getElementById('errormessage').innerHTML  = "<font color='#3300CC'>You have not entered your name.</font>";
		document.getElementById('SubmitDisplay').innerHTML  = "<img src='http://www.oxford.k12.ms.us/images/grayedsubmitbutton.png'/>";
		return false;		
	}
}

function ValidateEmail()
{
	if ( document.getElementById( "email" ).value.indexOf( "@oxford.k12.ms.us" ).value !="" )
	{
		document.getElementById('errormessage').innerHTML  = "";
		return true;
	}else
	{	
		document.getElementById('errormessage').innerHTML  = "<font color='#3300CC'>You have not filled in your district email address.</font>";
		document.getElementById('SubmitDisplay').innerHTML  = "<img src='http://www.oxford.k12.ms.us/images/grayedsubmitbutton.png'/>";
		return false;
	}
}

function ValidateSchoolunit()
{
	if ( document.getElementById( "school_unit" ).value !="" )
	{
		document.getElementById('errormessage').innerHTML  = "";
		return true;	
	}else
	{	
		document.getElementById('errormessage').innerHTML  = "<font color='#3300CC'>You have not filled in the School or Unit.</font>";
		document.getElementById('SubmitDisplay').innerHTML  = "<img src='http://www.oxford.k12.ms.us/images/grayedsubmitbutton.png'/>";
		return false;		
	}
}


function ValidateNominee()
{
	if ( document.getElementById( "nominee_name" ).value !="" )
	{
		document.getElementById('errormessage').innerHTML  = "";
		return true;	
	}
	else
	{	
		document.getElementById('errormessage').innerHTML  = "<font color='#3300CC'>You have not filled in the Nominee's Name.</font>";
		document.getElementById('SubmitDisplay').innerHTML  = "<img src='http://www.oxford.k12.ms.us/images/grayedsubmitbutton.png'/>";
		return false;
	}
}

function ValidateNomtitle()
{
	if ( document.getElementById( "nominee_title" ).value !="" )
	{
		document.getElementById('errormessage').innerHTML  = "";
		return true;	
	}
	else
	{	
		document.getElementById('errormessage').innerHTML  = "<font color='#3300CC'>You have not filled in the Nominee's Title.</font>";
		document.getElementById('SubmitDisplay').innerHTML  = "<img src='http://www.oxford.k12.ms.us/images/grayedsubmitbutton.png'/>";
		return false;
	}
}

function ValidateWhy()
{
	if ( document.getElementById( "why_nominated" ).value !="" )
	{
		document.getElementById('errormessage').innerHTML  = "";
		return true;

	}else
	{	
		document.getElementById('errormessage').innerHTML  = "<font color='#3300CC'>You have not filled in why the employee was nominated.</font>";
		document.getElementById('SubmitDisplay').innerHTML  = "<img src='http://www.oxford.k12.ms.us/images/grayedsubmitbutton.png'/>";
		return false;
	}
}

function ValidateQuote()
{
	if ( document.getElementById( "nominee_quote" ).value !="" )
	{
		document.getElementById('errormessage').innerHTML  = "";
		return true;

	}else
	{	
		document.getElementById('errormessage').innerHTML  = "<font color='#3300CC'>You have not filled in the nominee's quote or comment.</font>";
		document.getElementById('SubmitDisplay').innerHTML  = "<img src='http://www.oxford.k12.ms.us/images/grayedsubmitbutton.png'/>";
		return false;
	}
}

function ValidateForm()
{
	if ( ValidateName() && ValidateEmail() && ValidateSchoolunit() && ValidateNominee() && ValidateNomtitle() && ValidateWhy() && ValidateQuote() )
	{
		document.getElementById('SubmitDisplay').innerHTML  = "<input type='submit' value='Submit'>";
	}else
	{
		document.getElementById('SubmitDisplay').innerHTML  = "<img src='http://www.oxford.k12.ms.us/images/grayedsubmitbutton.png'/>";
	}		
}


</script>
</head>

<body>

<div id="Wrapper">

	<div id="Top">
		<div id="HeaderContent">
			<form name="search" id="search" method="post" action="../../osd_dev/search.php">
				<p>
					<input name="s" type="text" id="s" size="10" />
					<input type="submit" name="Submit" value="Go" />
					<br>
					<input name="radiobutton" type="radio" value="site" checked="checked" />Site | 
					<input name="radiobutton" type="radio" value="people" />People
				</p>
			</form>
		</div>

		<div id="Header">
			<img src="/images/header.gif">
		</div>

		<div id="TopBar">
			<a href="http://www.oxford.k12.ms.us" class="small">District Home</a>
		</div>

		<div id="PageLabel">Employee of the Week Referral Form</div>
            </div>
    
            <div id="Content">
            
            <table align="center" width="600" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td>
                
                <p>Employee of the Week nomination form and photo must be submitted two weeks in advance of the posting date for your school/Unit. </p>
                
                <p><em>All fields must be completed to submit your choice for Employee of the Week.</em><br />
                   <br /> </p>
            
			<?php
                //IF NO POST VARIABLES, PRINT FORM
					if ( !isset($_POST[name])  && !isset($_POST[email]) )
					{
						// ONE BIG PRINT STATEMENT OF THE HTML FORM IF NO POST VARIABLES EXIST
						print"
						<form method='post' action='eow_form.php'>
							<p class='copy-regular'><label>Your Name: <input style='font-family:verdana;font-size:12px' type='text' name='name' id='name' size='60' onmouseout= 'ValidateForm()' onchange= 'ValidateForm()'/></label></p>

							<p class='copy-regular'><label>Email: <input style='font-family:verdana;font-size:12px' type='text' name='email' id='email' size='65' onmouseout= 'ValidateForm()' onchange= 'ValidateForm()'/></label></p>

							<p class='copy-regular'><label>School or Unit: <input style='font-family:verdana;font-size:12px' type='text' name='school_unit' id='school_unit' size='57' onmouseout= 'ValidateForm()' onchange= 'ValidateForm()'/></label></p>

							<p class='copy-regular'><label>Name of Nominee: <input style='font-family:verdana;font-size:12px' type='text' name='nominee_name' id='nominee_name' size='54' onmouseout= 'ValidateForm()' onchange= 'ValidateForm()'/></label></p>

							<p class='copy-regular'><label>Nominee's Title: <input style='font-family:verdana;font-size:12px' type='text' name='nominee_title' id='nominee_title' size='56'onmouseout= 'ValidateForm()' onchange= 'ValidateForm()'/></label></p>

							<p class='copy-regular'><label>Describe why this employee has been selected for Employee of the Week:<br/><textarea style='font-family:verdana;font-size:12px' name='why_nominated' id='why_nominated' rows='10' cols='70' onmouseout= 'ValidateForm()' onchange= 'ValidateForm()'></textarea></label></p>

							<p class='copy-regular'><label>Quotation/Comment from Nominee:<br/><textarea style='font-family:verdana;font-size:12px' name='nominee_quote' id='nominee_quote' rows='10' cols='70' onmouseout= 'ValidateForm()' onchange= 'ValidateForm()'></textarea></label></p>

							<div id='errormessage'></div>
							<div id='SubmitDisplay'><img src='http://www.oxford.k12.ms.us/images/grayedsubmitbutton.png'/></div>
						</form>
						";//END OF PRINT HERE

					}else if ( isset($_POST[name])  && isset($_POST[email]) )
					{
						//PRINT CONFIRMATION MESSAGE TO USER
						print"<br/><br/><center/>
						<font size='2' face='Verdana' >
						Thank you for submitting the Employee of the Week.<br/><br/>
						<font color='#cc0000'><em>*Don't forget to email the nominee's photo to <a href='mailto:lhitchcock@oxford.k12.ms.us'><font color='#cc0000'><u>lhitchcock@oxford.k12.ms.us</u></font></a>.</em></font><br/><br/><br/>";

						//MAIL TO USER
						$recipient = 'lhitchcock@oxford.k12.ms.us';
						$subject = 'Employee of the Week Submission';
						$from = stripslashes($_POST['name']);
						$msg = 'This is an Automated Message! DO NOT REPLY! Please reply to $sender\n\nMessage from: $from\nEmail: $_POST[email]\n\nSchool Unit: $_POST[school_unit]\n\nNominee Name: $_POST[nominee_name]\n\nNominee Title: $_POST[nominee_title]\n\nWhy Nominated: $_POST[why_nominated]\n\nNominee Quote: $_POST[nominee_quote]\n\nReferred By: $_POST[name]\n';
						if ( !mail($recipient, $subject, $msg) )
						{
							print"
							<br/><br/>
							<font color='red'>Email Failure! Please try again!</font>
							";

						}

					}else
					{
						//SERVER PROBLEMS LIKELY CAUSE IF ALL ELSE FAILS
						print"<br/><br/><br/><center/>
						<font size='2' face='Verdana' >
						Internal Server Error, Please try again!";
					}
					?>
                
                </td>
              </tr>
            </table>

		</div>

Link to comment
https://forums.phpfreaks.com/topic/125465-solved-form-not-sending-email/
Share on other sites

Example mail() with headers for plain text:

 

$from = "me@mydomain.com";
$to = "you@yourdomain.com";
$sub = "Test Message";
$msg = "This is the body of the email";

$headers  = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/plain;\r\n";
$headers .= "X-Priority: 3\n";
$headers .= "X-MSMail-Priority: Normal\n";
$headers .= "X-Mailer: php\n";
$headers .= "From: \"".$from."\" <".$from.">\n";
$headers .= "Reply-To: \"".$from."\" <".$from.">\n";
// send the email
mail($to,$sub,$msg,$headers);

Ok, I added the headers. It's still not emailing, though...

 

<?php
//IF NO POST VARIABLES, PRINT FORM
if ( !isset($_POST[name])  && !isset($_POST[email]) )
{
// ONE BIG PRINT STATEMENT OF THE HTML FORM IF NO POST VARIABLES EXIST
print"
<form method='post' action='eow_form.php'>
<p class='copy-regular'><label>Your Name: <input style='font-family:verdana;font-size:12px' type='text' name='name' id='name' size='60' onmouseout= 'ValidateForm()' onchange= 'ValidateForm()'/></label></p>

<p class='copy-regular'><label>Email: <input style='font-family:verdana;font-size:12px' type='text' name='email' id='email' size='65' onmouseout= 'ValidateForm()' onchange= 'ValidateForm()'/></label></p>

<p class='copy-regular'><label>School or Unit: <input style='font-family:verdana;font-size:12px' type='text' name='school_unit' id='school_unit' size='57' onmouseout= 'ValidateForm()' onchange= 'ValidateForm()'/></label></p>

<p class='copy-regular'><label>Name of Nominee: <input style='font-family:verdana;font-size:12px' type='text' name='nominee_name' id='nominee_name' size='54' onmouseout= 'ValidateForm()' onchange= 'ValidateForm()'/></label></p>

<p class='copy-regular'><label>Nominee's Title: <input style='font-family:verdana;font-size:12px' type='text' name='nominee_title' id='nominee_title' size='56'onmouseout= 'ValidateForm()' onchange= 'ValidateForm()'/></label></p>

<p class='copy-regular'><label>Describe why this employee has been selected for Employee of the Week:<br/><textarea style='font-family:verdana;font-size:12px' name='why_nominated' id='why_nominated' rows='10' cols='70' onmouseout= 'ValidateForm()' onchange= 'ValidateForm()'></textarea></label></p>

<p class='copy-regular'><label>Quotation/Comment from Nominee:<br/><textarea style='font-family:verdana;font-size:12px' name='nominee_quote' id='nominee_quote' rows='10' cols='70' onmouseout= 'ValidateForm()' onchange= 'ValidateForm()'></textarea></label></p>

<div id='errormessage'></div>
<div id='SubmitDisplay'><img src='http://www.oxford.k12.ms.us/images/grayedsubmitbutton.png'/></div>
</form>
";//END OF PRINT HERE

}else if ( isset($_POST[name])  && isset($_POST[email]) )
{
//PRINT CONFIRMATION MESSAGE TO USER
print"<br/><br/><center/>
<font size='2' face='Verdana' >
Thank you for submitting the Employee of the Week.<br/><br/>
<font color='#cc0000'><em>*Don't forget to email the nominee's photo to <a href='mailto:lhitchcock@oxford.k12.ms.us'><font color='#cc0000'><u>lhitchcock@oxford.k12.ms.us</u></font></a>.</em></font><br/><br/><br/>";

//MAIL TO USER
$recipient = 'lhitchcock@oxford.k12.ms.us';
$subject = 'Employee of the Week Submission';
$from = stripslashes($_POST['name']);
$msg = 'This is an Automated Message! DO NOT REPLY! Please reply to $sender\n\nMessage from: $from\nEmail: $_POST[email]\n\nSchool Unit: $_POST[school_unit]\n\nNominee Name: $_POST[nominee_name]\n\nNominee Title: $_POST[nominee_title]\n\nWhy Nominated: $_POST[why_nominated]\n\nNominee Quote: $_POST[nominee_quote]\n\nReferred By: $_POST[name]\n';

$headers  = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/plain;\r\n";
$headers .= "X-Priority: 3\n";
$headers .= "X-MSMail-Priority: Normal\n";
$headers .= "X-Mailer: php\n";
$headers .= "From: \"".$from."\" <".$from.">\n";
$headers .= "Reply-To: \"".$from."\" <".$from.">\n";
// send the email
if ( !mail($recipient, $subject, $msg) )
{
print"
<br/><br/>
<font color='red'>Email Failure! Please try again!</font>
";

}

}else
{
//SERVER PROBLEMS LIKELY CAUSE IF ALL ELSE FAILS
print"<br/><br/><br/><center/>
<font size='2' face='Verdana' >
Internal Server Error, Please try again!";
}
?>

Just put this together, a bit tidier but I haven't tested it but it should work. 

 

 

<?

$name = $_POST['name'];
$unit = $_POST['schoolunit'];
$email = $_POST['email'];
$nomname = $_POST['nominee_name'];
$nomtitle = $_POST['nominee_title'];
$whynom = $_POST['why_nominated'];
$nomquote = $_POST['nominee_quote'];




$msgsentdate = date("Y-m-d G:i:s");

$sender = "Sender Name";
$adminemail = "lhitchcock@oxford.k12.ms.us";
$msgsubject = "Employee of the Week Submission";


			$additional_headers = "From:" .$name. "\n"
	  					     ."Reply - To:" .$email."\n";


			$mailcontent = "This is an automated message. DO NOT REPLY! Please reply to" .$sender."\n"

										  ."Mesage from:" . $email."\n"
										  ."Message Sent: " . $msgsentdate. "\n"
										  ."Contact Email:" . $conemail."\n"
										  
										  ."School Unit: " . $unit. "\n\n"
										  ."Nominee Name: " .$nomname. "\n"
										  ."Why Nominated: " . $whynom. "\n"
									  	  ."Nominee Quote: " . $nomquote. "\n"
									  
									  	  ."Reffered By: " . $name. "\n\n";
										  




			$subject = $msgsubject;

			$to = $adminemail;

			mail($to, $subject, $mailcontent,$additional_headers);
 ?>

I tried mark's suggestion... Still no emails. >_< Maybe I plugged it in incorrectly?

 

<?php
                //IF NO POST VARIABLES, PRINT FORM
					if ( !isset($_POST[name])  && !isset($_POST[email]) )
					{
						// ONE BIG PRINT STATEMENT OF THE HTML FORM IF NO POST VARIABLES EXIST
						print"
						<form method='post' action='eow_form.php'>
							<p class='copy-regular'><label>Your Name: <input style='font-family:verdana;font-size:12px' type='text' name='name' id='name' size='60' onmouseout= 'ValidateForm()' onchange= 'ValidateForm()'/></label></p>

							<p class='copy-regular'><label>Email: <input style='font-family:verdana;font-size:12px' type='text' name='email' id='email' size='65' onmouseout= 'ValidateForm()' onchange= 'ValidateForm()'/></label></p>

							<p class='copy-regular'><label>School or Unit: <input style='font-family:verdana;font-size:12px' type='text' name='school_unit' id='school_unit' size='57' onmouseout= 'ValidateForm()' onchange= 'ValidateForm()'/></label></p>

							<p class='copy-regular'><label>Name of Nominee: <input style='font-family:verdana;font-size:12px' type='text' name='nominee_name' id='nominee_name' size='54' onmouseout= 'ValidateForm()' onchange= 'ValidateForm()'/></label></p>

							<p class='copy-regular'><label>Nominee's Title: <input style='font-family:verdana;font-size:12px' type='text' name='nominee_title' id='nominee_title' size='56'onmouseout= 'ValidateForm()' onchange= 'ValidateForm()'/></label></p>

							<p class='copy-regular'><label>Describe why this employee has been selected for Employee of the Week:<br/><textarea style='font-family:verdana;font-size:12px' name='why_nominated' id='why_nominated' rows='10' cols='70' onmouseout= 'ValidateForm()' onchange= 'ValidateForm()'></textarea></label></p>

							<p class='copy-regular'><label>Quotation/Comment from Nominee:<br/><textarea style='font-family:verdana;font-size:12px' name='nominee_quote' id='nominee_quote' rows='10' cols='70' onmouseout= 'ValidateForm()' onchange= 'ValidateForm()'></textarea></label></p>

							<div id='errormessage'></div>
							<div id='SubmitDisplay'><img src='http://www.oxford.k12.ms.us/images/grayedsubmitbutton.png'/></div>
						</form>
						";//END OF PRINT HERE

					}else if ( isset($_POST[name])  && isset($_POST[email]) )
					{
						//PRINT CONFIRMATION MESSAGE TO USER
						print"<br/><br/><center/>
						<font size='2' face='Verdana' >
						Thank you for submitting the Employee of the Week.<br/><br/>
						<font color='#cc0000'><em>*Don't forget to email the nominee's photo to <a href='mailto:lhitchcock@oxford.k12.ms.us'><font color='#cc0000'><u>lhitchcock@oxford.k12.ms.us</u></font></a>.</em></font><br/><br/><br/>";

						//MAIL TO USER
						$name = $_POST['name'];
						$unit = $_POST['schoolunit'];
						$email = $_POST['email'];
						$nomname = $_POST['nominee_name'];
						$nomtitle = $_POST['nominee_title'];
						$whynom = $_POST['why_nominated'];
						$nomquote = $_POST['nominee_quote'];




						$msgsentdate = date("Y-m-d G:i:s");

						$sender = "Sender Name";
						$adminemail = "lhitchcock@oxford.k12.ms.us";
						$msgsubject = "Employee of the Week Submission";


										$additional_headers = "From:" .$name. "\n"
														 ."Reply - To:" .$email."\n";


										$mailcontent = "This is an automated message. DO NOT REPLY! Please reply to" .$sender."\n"

										  ."Mesage from:" . $email."\n"
										  ."Message Sent: " . $msgsentdate. "\n"
										  ."Contact Email:" . $conemail."\n"
										  
										  ."School Unit: " . $unit. "\n\n"
										  ."Nominee Name: " .$nomname. "\n"
										  ."Why Nominated: " . $whynom. "\n"
									  	  ."Nominee Quote: " . $nomquote. "\n"
									  
									  	  ."Reffered By: " . $name. "\n\n";
													  




						$subject = $msgsubject;

						$to = $adminemail;

						mail($to, $subject, $mailcontent,$additional_headers);
						{
							print"
							<br/><br/>
							<font color='red'>Email Failure! Please try again!</font>
							";

						}

					}else
					{
						//SERVER PROBLEMS LIKELY CAUSE IF ALL ELSE FAILS
						print"<br/><br/><br/><center/>
						<font size='2' face='Verdana' >
						Internal Server Error, Please try again!";
					}
					?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.