Email HTML form

Hello. I recently transferred a customers website to my server and the email from stopped working. I have been over everything and cant find the problem, any help would be great.

Here is the website:

[code]

Contact Us At Speedy-Clean USA 800-334-3528
<!-- BEGIN .styles -->
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" />                      
<link rel="stylesheet" href="css/prettyPhoto.css" type="text/css" media="screen" />   
<link rel="stylesheet" href="css/tipsy.css" type="text/css" media="screen" />              
<link rel="stylesheet" href="css/jCarousel.css" type="text/css" media="screen" />  

<!--[if IE]> 
    <link rel="stylesheet" href="css/ie.css" type="text/css" media="screen, projection" /> 
<![endif]-->
<!--[if IE 7]>
    <link rel="stylesheet" href="css/ie7.css" type="text/css" media="screen" />
<![endif]-->
  
<link rel="stylesheet" href="css/colors/black.css" type="text/css" media="screen" />   <!-- COLOR -->                
<!-- END .styles -->           

<!-- BEGIN .scripts -->
<script type='text/javascript' src='js/jquery.js'></script>
<script type='text/javascript' src='js/ui.core.js'></script>
<script type='text/javascript' src='js/jquery.cycle.all.min.js'></script>
<script type='text/javascript' src='js/jquery.nivo.slider.pack.js'></script>
<script type='text/javascript' src='js/jquery.easing.1.3.js'></script>
<script type='text/javascript' src='js/jquery.prettyPhoto.js'></script>
<script type='text/javascript' src='js/jquery.jcarousel.min.js'></script>
<script type='text/javascript' src='js/jquery.tipsy.js'></script>
<script type='text/javascript' src='js/jquery.arrowFade.js'></script>
<script type='text/javascript' src='js/ui.tabs.js'></script>
<script type='text/javascript' src='js/jquery.custom.js'></script>                 
<script type='text/javascript' src='js/jquery.tweetable.js'></script> 

<script type='text/javascript' src='js/cufon-yui.js'></script>
<script type='text/javascript' src='js/waukegan.font.js'></script>   
<!-- END .scripts -->           

<!-- [favicon] begin -->
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
<link rel="icon" type="image/x-icon" href="favicon.ico" />  
<!-- [favicon] end -->
  
<script type="text/javascript">
    Cufon.replace('h1, h2, h3:not(#footer h3, .title-blog), h4, h5, h6, table th', {fontFamily: 'Waukegan'});
    //Cufon.replace('.sidebar-nav a', {fontFamily: 'Champagne', hover: true});       
    
    jQuery(document).ready(function($){
        $("a[rel^='prettyPhoto']").prettyPhoto({
            theme: 'facebook'});
    });
</script>             
<!-- START HEADER -->
<div id="header">
    
    <div class="inner">
    
        <!-- START LOGO -->
        <div id="logo">
            <a href="index.html" title="Speedy-Clean USA">Speedy-Clean USA</a>
        </div>
        <!-- END LOGO -->
		
		<!-- START NAV -->
        <div id="nav">
			
			<ul class="level-1 black">
				
				<li>
					<a href="index.html">Home</a>
					<ul class="sub-menu">
					  <li>
							<a href="company.html">Company</a>
							
					</ul>
				</li>
				<li>
					<a href="internationalpartners.html">Where to Find</a><span> Interactive Map</span>
					<ul class="sub-menu">
						<li><a href="internationalpartners.html">International</a></li>
					
				  </ul>
		    </li>
				
				<li>
					<a href="generalproductinfo.html">Products</a><span> Our Lineup</span>
					<ul class="sub-menu">
						<li>
							<a href="generalproductinfo.html">SPEEDY PRODUCTS</a>
							<ul class="sub-menu">                           
								<li><a href="concretedissolverinfo.html">SPEEDY-CLEAN Concrete & Mortar Dissolver</a></li> 
								<li><a href="speedyshieldinfo.html">SPEEDY SHIELD Truck and Equipment Coating</a></li>
								<li><a href="speedy-etchinfo.html">SPEEDY ETCH Concrete Floor Etching Solution</a></li>
								<li><a href="speedysealinfo.html">SPEEDY SEAL Rubberized Instant Leak Sealer</a></li>
							</ul>
						</li>             
						<li>
							<a href="winterproductinfo.html">WINTER PRODUCTS</a>   
							<ul class="sub-menu">    
								<li><a href="chuck-itinfo.html">CHUCK-IT'S Ice & Snow Melting Tabs</a></li>
								<li><a href="icebusterinfo.html">ICE BUSTER Granular Snow & Ice Melt</a></li>
								<li><a href="subzeroinfo.html">SUB ZERO Liquid Ice Melt</a></li> 
							</ul>
						</li>       
					<li>
							<a href="generalproductinfo.html">MORE PRODUCTS</a>   
							<ul class="sub-menu">    
								<li><a href="nightbriteinfo.html">NIGHT-BRIGHT Super Reflective Coating</a></li>
								<li><a href="rescue911info.html">RESCUE 911 Rubberized Leak Sealer</a></li>
								<li><a href="easypatchinfo.html">EASY PATCH Light Activated Patch</a></li>
								<li><a href="prowlerinfo.html">PROWLER Waterless Car Wash</a></li> 
                                <li><a href="reaminfo.html">REAM POWER UNCLOGGER</a></li>
                                <li><a href="blackmagicinfo.html">BLACK MAGIC</a></li>
                                <li><a href="tractioninfo.html">SURE TRACTION</a></li> 
							</ul>
						</li></ul>
				</li>
				<li><a href="distributorportal.html">Distributors</a><span> Portal Login</span></li>
				
				<li>
					<a href="contact_without_map.html">Contact</a><span> Phone/Email</span>
					
				</li>
				
			</ul>
			
	  </div>            
		<!-- END NAV -->
        
        <div class="clear"></div>
        
    </div>
        
</div>
<!-- END HEADER -->   


<!-- START CONTENT -->
<div id="content">

    <div class="inner">                 
		<div class="text">
            <h2 class="title-page">Contact Us At SPEEDY CLEAN</h2>                    
            
			<p>
				Thank you for your inquiry. We appreciate your interest in our products and welcome your business. Please use the form below to email your questions or comments. You may also email us at: [email protected] or use one of the convenient phone numbers to the right.
			</p>

			<div id="usermessagea"></div>
			
			<form action="sendmail.php" method="post" class="form-contact" id="form-contact">
				<ol class="cf-ol">
					<li>
						<label for="name"><span>Name</span></label>
						<input type="text" name="name" id="name" class="required" />
						<span class="reqtxt">(required)</span>
					</li>
					
					<li>
						<label for="email"><span>Email</span></label>
						<input type="text" name="email" id="email" class="required" />
						<span class="emailreqtxt">(valid email required)</span>
					</li>
					
					<li>
						<label for="subject"><span>Subject</span></label>
						<input type="text" name="subject" id="subject" class="single" />
					</li>
					
					<li>
						<label for="message"><span>Message</span></label>
						<textarea cols="30" rows="8" name="message" id="message" class="area"></textarea>
					</li>
				</ol>
				
				<input type="hidden" name="action" value="send">
				
				<p class="cf-sb">
					<input type="submit" name="sendbutton" id="sendbutton" class="sendbutton" value="Send" />
				</p>
			</form>
		</div>
		
		            
        <!-- START SIDEBAR -->
        <div class="sidebar">     
			
			<div class="widget">
                <h2>Get in touch</h2>
                
                <ul>                           
                    <li id="phone-icon"><strong>TOLL FREE:</strong> 800-334-3528</li>
                    <li id="phone-icon"><strong>DIRECT:</strong> 702-736-6500</li>
                    <li id="fax-icon"><strong>FAX US:</strong> 702-948-6332</li>
                    <li id="fax-icon"><strong>FAX US:</strong> 702-949-3106</li>                     
                </ul>
            </div>                        
                
            <div class="clear"></div>
                                          
            <div class="widget">
                <h2>Social</h2>
                
                <a href="#" class="socials facebook" title="Facebook">facebook</a>
				<a href="#" class="socials rss" title="Rss">rss</a>
				<a href="#" class="socials twitter" title="Twitter">twitter</a>
				<a href="#" class="socials youtube" title="Youtube">youtube</a>
				<a href="#" class="socials yahoo" title="Yahoo">yahoo</a>
				<a href="#" class="socials vimeo" title="Vimeo">vimeo</a>
				<a href="#" class="socials flickr" title="Flickr">flickr</a>
				<a href="#" class="socials blogger" title="Blogger">blogger</a>
 
                <div class="clear"></div> 
            </div>                                    
                
            <div class="clear"></div>
            
            <div class="widget">
                <h2>Find Us At SPEEDY CLEAN</h2>
                <address>
                    4550 Ziebart Place<br />
					Las Vegas, NV 89103                    
				</address>     
            </div>

			          
		</div>            
        <!-- END SIDEBAR -->
                    
    </div>              

	<div class="clear"></div>

</div>
<!-- END CONTENT -->  

<!-- START FLASH NEWS -->
<div class="news-home">
    
    <div class="inner">
        <h2>News</h2>
        
        <ul>
            <li><a href="generalproductinfo.html">Speedy-Clean recognized for innovative products and technology at CON EXPO '11</a> | March 22-26, 2011</li>
            <li><a href="nightbriteinfo.html">Speedy-Clean launches NIGHT BRITE - Reflective coating for increased visibility at night!</a> | March 1, 2011</li>
            <li><a href="concretedissolverinfo.html">&quot;Speedy-Clean Non-Acid CONCRETE &amp; MASONRY DISSOLVER revolutionizes the concrete world!&quot;</a> | <a href="#">WORLD OF CONCRETE</a> January 2011</li>
        </ul>
    </div>        
        
    <div class="clear"></div>
                  
</div>
<!-- END FLASH NEWS -->
  

<!-- START COPYRIGHT -->
<p id="copyright">© Copyright 2011 - <a href="http://www.speedycleanusa.com">Speedy-Clean, LLC</a> • All Rights Reserved</p>
<!-- END COPYRIGHT -->                                    

<script type="text/javascript">
    //<![CDATA[
    Cufon.now();  //]]>   
</script>

     

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-8632327-9']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>
[/code]

And here is the sendmail.php
[php]<?php

/**

  • Define the email witch send the email written by the user
    */
    define(‘TO’, ‘[email protected]’);

/**

/**

  • define the body of the email. You can add some shortcode, with this format: %ID%
  • ID = the id have you insert on the html markup.
  • e.g.
  • You can add on BODY, this:
  • email: %email%
    */
    define(‘BODY’, ‘This email is been sent by %name%, email %email%.

    %message%’);

// NO NEED EDIT
function sendemail()
{
if ( isset( $_POST[‘action’] ) AND $_POST[‘action’] == ‘send’ )
{
$body = BODY;

    if( !is_string( $_POST['name'] ) OR $_POST['name'] == '' )
    	return '<p class="error">Insert correct name</p>';
    
    if( !is_email( $_POST['email'] ) OR $_POST['email'] == '' ) 
    	return '<p class="error">Insert correct email</p>';
    
    $subject = $_POST['subject'];
    
    if( !is_email( $subject ) OR $subject == '' )
    	$subject = 'Email without subject.';
    
    foreach( array_map( 'stripslashes', $_POST ) as $id => $var )
    {
    	if( $id == 'message' ) $var = nl2br($var);
		$body = str_replace( "%$id%", $var, $body );	
	}
    
	$headers  = 'MIME-Version: 1.0' . "\r\n";
	$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
	$headers .= "From: [email protected]\r\n";

    $sendmail = mail(TO, $subject, $body, $headers);
         
	if ($sendmail) 
		return '<p class="success">Email sent correctly!</p>';
    else
		return '<p class="error">An error has been encountered. Please try again.</p>';
} 

}

function is_email($email)
{
if (!preg_match("/[a-z0-9][_.a-z0-9-]+@([a-z0-9][0-9a-z-]+.)+([a-z]{2,4})/" , $email))
{
return false;
}
else
{
return true;
}
}

echo sendemail();

?>
[/php]
Thanks in advance

Well, I do not see anything at first glance wrong with your code. I am sure something is wrong as it is not working for you. So, do you understand how to debug PHP script’s? I would suggest trying a few simple things to start.

You can display various code values (variables) using echo to see what is being sent to the mail function…
And… !!! Wait, just notice that your email’s mail function sends nothing for the “TO:” value…
That wont’ work… So,
$sendmail = mail(TO, $subject, $body, $headers);
The first argument should be the “to” address. Here it is some text called “TO”, not a variable such as $to or any other string. That is where the mail() function fails… I am sure that is the error…

Sponsor our Newsletter | Privacy Policy | Terms of Service