Here is the html part of the form
<html> <head> </head> <body> <form name="contactform" action="send_form_email.php" method="post"> <!-- The following line specified which fields are required. List field names EXACTLY as they are named in the form. --> <input type="hidden" name="Required" value="Name,Email,Phone,Comments"> <p>Name: <input name="Name" size="25"> <span class="small">required</span></p> <p>Company: <input name="Company" id="Company" size="25"></p> <p>E-mail: <input name="Email" size="25"> <span class="small">required</span></p> <p>Phone: <input name="Phone" size="25"> <span class="small">required</span></p> <p>How you heard of us: <input name="Howheard" size="25"></p> <p>Comments:</p> <p><textarea name="Comments" rows="5" cols="30"></textarea> <span class="small">required</span></p> <p><input type="submit" value="Submit" name="submitform"><input type="reset" value="Reset" name="reset"></p> </form> </BODY> </HTML>
And here is the PHP script for it.
<?php
error_reporting(E_ALL ^ E_NOTICE);
$mailTo = "MY GMAIL EMAIL ADDRESS"; // The address that will receive form submissions
$mailSubject = "christmas"; // Whatever you want
$mailHost = "ssl://smtp.gmail.com"; // Usually looks like mail.yourhost.com
$mailPort = "465"; // Usually 25
$mailAuth = true; // "true" if your mail server requires authentication, "false" if not
$mailPassword = "MY GMAIL PASSWORD"; // The mail password associated with $mailTo
$name = $HTTP_POST_VARS['Name'];
$company = $HTTP_POST_VARS['Company'];
$email = $HTTP_POST_VARS['Email'];
$comments = $HTTP_POST_VARS['Comments'];
$howheard = $HTTP_POST_VARS['Howheard'];
$reqFields = $HTTP_POST_VARS['Required'];
$date = date("l jS F Y, g:i A");
{
$browser = $HTTP_USER_AGENT;
$ip = $REMOTE_ADDR;
// Build the email.
$body = " Name: $Name
Company: $Company
Email: $Email
Phone: $Phone
Heard of us from: $howheard
----- Comments -----
$Comments
--------------------
Date: $date
Browser: $browser
User IP: $ip";
include("mail.php");
$headers["From"] = $mailTo;
$headers["To"] = $mailTo;
$headers["Subject"] = $mailSubject;
$params["host"] = $mailHost;
$params["port"] = $mailPort;
$params["auth"] = $mailAuth;
$params["username"] = $mailTo;
$params["password"] = $mailPassword;
$mail_object =& mail::factory("smtp", $params);
$mail_object->send($mailTo, $headers, $body);
?>
<h1>Thank You</h1>
<p>Thank you for contacting us. We will be in touch with you shortly.</p>
<?php
}
?>
So any help is much appreciated to get this working, I would also like the from field in my revived email to be the email entered in in the form.
Help Appreciated: Elliott Veares


Sign In
Create Account

Back to top









