Email form

I am currently using mezoka (they allow php 5) to upload my site and currently they dont allow the php mail(). I was wondering if someone could possible help me with my php contact form? When I ran it on my local host I got a few undefined errors, I think those had to do with my variable names not matching, which I corrected now. What I want my contact form to do is, when I have it on my website, I want the user to be able to put in their email address and from their email address send my an email at my yahoo email account (starr@yahoo.com). I have heard that a phpmailer is the way to go, but not too sure how or implement.

This is my php so far that I have.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
	<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />	<title>Contact</title>
	<link href="style.css" rel="stylesheet" type="text/css" />
	 
	</head>
	<body>
	 
	<div id="templatemo_wrapper">
	 
	    <div id="templatemo_header">
	 
	  
	         
	        <ul id="social_box">
	                    <li><a href="http://www.facebook.com/"><img src="images/facebook.png" alt="facebook" /></a></li>
	            <li><a href="http://www.twitter.com/"><img src="images/twitter.png" alt="twitter" /></a></li>             
	        </ul>
	         
	        <div id="site_title">
	            <h1><a href="index.htm"><img src="images/logo2.png" alt="logo" /><span></span></a></h1>
	        </div> <!-- end of site_title -->
	         
	       
	    </div> <!-- end of templatemo_header -->
	     
	<div id="templatemo_menu">
	        <div class="home"><a href="index.htm"></a></div>
	        <ul>
	          <li><a href="index.htm"><span>Home</span></a></li>
	            <li><a href="test.htm"><span>Test</span></a></li>
	            <li><a href="examples.htm"><span>Examples</span></a></li>
	            <li><a href="question.htm"><span>Questions</span></a></li>
	        <li><a href="contact.htm"><span>Contact</span></a></li>
	            <li><a href="comments.htm">Have A Comment?<span>Comments</span></a></li>
	        </ul>    
	    </div>
	 
	<!-- end of templatemo_menu -->
	     
	    <div id="templatemo_content_wrapper">
	        <div id="templatemo_content_top"></div>
	        <div id="templatemo_content">
	         
	            <h2>Contact</h2>
	 
	 
	         
	            <div class="cleaner_h50"></div>
	             
	                <div id="contact_form">
	             
	                    <h4>Quick Contact</h4>
	                     
	                    <form method="post" name="contact" action="email.php">
	                         
	                        <div class="col_w340 float_l">
	                         
	                            <label for="namer">Name:</label> <input name="name" type="text" class="input_field" id="author" maxlength="40" />
	                            <div class="cleaner_h10"></div>
	                             
	                            <label for="email">Email:</label> <input name="email" type="text" class="input_field" id="email" maxlength="40" />
	                            <div class="cleaner_h10"></div>
	                             
	                             
	                        </div>
	                         
	                        <div class="col_w340 float_r">
	                         
	                            <label for="text">Message:</label> <textarea id="text" name="text" rows="0" cols="0" class="required"></textarea>
	                            <div class="cleaner_h10"></div>
	                             
	                            <input type="submit" class="submit_btn float_l" name="submit" id="submit" value="Send" />
	                            <input type="reset" class="submit_btn float_r" name="reset" id="reset" value="Reset" />
	                             
	                        </div>
	                         
	                   </form>
	 
	            </div>	 
	            <div class="cleaner"></div>
	             
	        </div>
	        <div id="templatemo_content_bottom"></div>
	    </div>
	     
	    <div id="templatemo_sp_box">
	     
	        <div class="col_w340 float_l">
	            </div>
	        </div>
	         
	        <div class="col_w340 float_r">
	         
	            </div>
	        </div>
	     
	    </div>
	     
	    <div id="templatemo_footer">
	 
	       
	        Copyright © 2011 <a href="www.twitter.com/">Starr</a><br/>
	        <a href="http://www.iwebsitetemplate.com" target="_parent">Website Templates</a>
	        by <a href="http://www.templatemo.com" target="_parent">Free CSS Templates</a>
	     
	    </div> <!-- end of templatemo_footer -->
	     
	</div> <!-- end of templatemo_wrapper -->   
	 
	</body>
	</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	 	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
	 
	<html xmlns="http://www.w3.org/1999/xhtml">
	 
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
	<title>Contact</title>
	</head>
	 
	<body>
	<?php
	$to = "starr@yahoo.com";
	$body = $_POST["message"];
	$headers = "From: [email]user@domain.com[/email]\
";
	mail($to,$body,$headers);
	echo "Mail sent to $to";
	 
	?>
	 
	 
	</body>
	 
	</html>

Hi,
If you use phpmailer for gmail, you just need to set into the file code the name and the password of your gmail account.
The visitors messages will be send to your e-mail address via the smtp gmail server.
I downloaded the phpmail pacxkage and the file “test_smtp_gmail_basic.php” is in the “examples” folder.

I didnt find the test_smtp_gmail_basic.php in package. Also, does the test_smtp_gmail_basic.php require that my client puts their password or no? I heard from a few people say there a few codes that require a passwork in order to send mail.

Hy,
You can use the exemple presented in the “test_smtp_gmail_basic.php”, located in “examples/” directory (in the package with the phpmailer).
Or, if you want a ready made contact form, see this script Contact Form, PHP - AJAX, it has included the PHPmailer, and cand send the message via GMail.

I got my contact form working now, I just need a help with a few minor things. When I send a test email it says its from an unknown sender, I would like for that to say the persons first and last name. Then I would like to add a captcha code in order to avoid spam. And finally, I would like it, so that when I hit the reply button from my inbox, the users email address shows up, right now it doesnt do that, I have to put it in manually. PHP Contact form with image code verification <—This is what I am going for.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Contact</title>
<link href="style.css" rel="stylesheet" type="text/css" />

</head>
<body>

<div id="templatemo_wrapper"> 

	<div id="templatemo_header">

 
        
        <ul id="social_box">
                    <li><a href="http://www.facebook.com/"><img src="images/facebook.png" alt="facebook" /></a></li>
            <li><a href="http://www.twitter.com/><img src="images/twitter.png" alt="twitter" /></a></li>              
        </ul>
        
      	<div id="site_title">
            <h1><a href="index.htm"><img src="images/logo2.png" alt="logo" /><span></span></a></h1>
        </div> <!-- end of site_title -->
        
      
    </div> <!-- end of templatemo_header -->
    
<div id="templatemo_menu">
    	<div class="home"><a href="index.htm"></a></div>
        <ul>
          <li><a href="index.htm"><span>Home</span></a></li>
            <li><a href="test.htm"><span>Test</span></a></li>
            <li><a href="example.htm"><span>Examples</span></a></li>
            <li><a href="gallery.htm"><span>Gallery</span></a></li>
	    <li><a href="contact.htm"><span>Contact</span></a></li>
            <li><a href="comments.htm">Have A Comment?<span>Comments</span></a></li>
        </ul>    	
    </div> 

<!-- end of templatemo_menu -->
    
    <div id="templatemo_content_wrapper">
    	<div id="templatemo_content_top"></div>
        <div id="templatemo_content">
        
            <h2>Contact</h2>



<p><b>E-mail: starr@gmail.com </b></p>

<p><b><a href="http://www.twitter.com/">Twitter</a></b></p>
        
            <div class="cleaner_h50"></div>
            
            	<div id="contact_form">
            
                    <h4>Quick Contact</h4>
                    
                    <form method="post" name="contact" action="email.php">
                        
                        <div class="col_w340 float_l">
                        
                            <label for="namer">Name:</label> <input name="name" type="text" class="input_field" id="author" maxlength="40" />
                          	<div class="cleaner_h10"></div>

 <label for="subject">Subject:</label> <input name="subject" type="text" class="input_field" id="subject" maxlength="40" />
                          	<div class="cleaner_h10"></div>

                            
                            <label for="email">Email:</label> <input name="email" type="text" class="input_field" id="email" maxlength="40" />
                          	<div class="cleaner_h10"></div>
                            
                            
                        </div>
                        
                        <div class="col_w340 float_r">
                        
                            <label for="text">Message:</label> <textarea id="text" name="text" rows="0" cols="0" class="required"></textarea>
                            <div class="cleaner_h10"></div>
                            
                            <input type="submit" class="submit_btn float_l" name="submit" id="submit" value="Send" />
                            <input type="reset" class="submit_btn float_r" name="reset" id="reset" value="Reset" />
                            
                        </div>
                        
                   </form>

            </div> 

            <div class="cleaner"></div>
            
        </div>
        <div id="templatemo_content_bottom"></div>
	</div>
    
    <div id="templatemo_sp_box">
    
    	<div class="col_w340 float_l">
         
			</div>
        </div>
        
        <div class="col_w340 float_r">
        
			</div>
        </div>
    
    </div>
    
    <div id="templatemo_footer">

      
        Copyright © 2011 <a href="www.twitter.com/">Starr</a><br/> 
        <a href="http://www.iwebsitetemplate.com" target="_parent">Website Templates</a> 
        by <a href="http://www.templatemo.com" target="_parent">Free CSS Templates</a>
    
    </div> <!-- end of templatemo_footer -->
    
</div> <!-- end of templatemo_wrapper -->    

</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Contact</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php


$first_name=$_POST['name'];
$email_address=$_POST['email'];
$subject=$_POST['subject'];
$message=$_POST['text'];

mail("starr@gmail.com","Subject: $subject",
$message, "From: $email");

echo "Thank you for using our mail form.<br/>";
echo "Your email has been sent.";

?>

</body>
</html>

Hy,
You can use the phpmailer class, its free and with examples of how to use it.
You should use another email account, with SMTP server, like GMail, then use the phpmailer to send the mail via that SMTP server.
Better get the class and see their examples.

PHP Tutorial: Sending Email with PHP Like this in the example? I’ve never really used a PHPmailer class, so I am really unsure of a few things.