How to configure WAMP and Smtp server - forms

I have spent a significant time looking for an answer, and tried every solution without success :/
Basically I want to use wamp server to create contact form that will be sent to my mail address.
I have wamp running but for the life of me I can't figure out why I wouldn't receive the mails, I either get the 404 page when submitting the form, or lately "Warning: mail(): SMTP server response: 553 sorry, that domain isn't in my list of allowed rcpthosts".
I am now looking for a solution that will at least send the form to my address, whether it's secured or not I just want to see an actual mail successfully sent.
Thanks !
edit: here is the code:
<!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>
<title> Contact Form</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div id="page-wrap">
<div id="contact-area">
<form method="post" action="contactengine.php">
<label for="Name">Name:</label>
<input type="text" name="Name" id="Name" />
<label for="Email">Email:</label>
<input type="text" name="Email" id="Email" />
<label for="Message">Message:</label><br />
<textarea name="Message" rows="20" cols="20" id="Message"> </textarea>
<input type="submit" name="submit" value="Submit" class="submit-button" />
</form>
<div style="clear: both;"></div>
</div>
</div>
</body>
</html>
--then the contact engine--
<?php
$EmailFrom = "myadress#mail.com";
$EmailTo = "myadress#mail.com";
$Subject = "Nice & Simple Contact Form by CSS-Tricks";
$Name = Trim(stripslashes($_POST['Name']));
$Tel = Trim(stripslashes($_POST['Tel']));
$Email = Trim(stripslashes($_POST['Email']));
$Message = Trim(stripslashes($_POST['Message']));
// validation
$validationOK=true;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
exit;
}
// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Tel: ";
$Body .= $Tel;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "\n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.php\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
?>
--then the thanks message--
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<head>
<title>A Nice & Simple Contact Form</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div id="page-wrap">
<img src="images/title.gif" alt="A Nice & Simple Contact Form" />
<p>By CSS-Tricks</p>
<br /><br />
<h1>Your message has been sent!</h1><br />
<p>Back to Contact Form</p>
</div>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-68528-29";
urchinTracker();
</script>
</body>
</html>

Windows does not come with a Mail Server so just calling mail() will work as far as php is concerned but the mail goes nowhere.
You either need to install a mail server or use something like the PHPMailer library to allow you to send SMTP mails via something like Yahoo or Google.

Related

codeigniter sending email with logo not working

I'm using CI version 3 and I'm using the built in email functionality to send an HTML email template.
My code is as following:
public function send_email($sendTo, $fromName, $fromEmail, $data, $subject) {
$this->email->set_mailtype('html');
$this->email->from($fromEmail, $fromName);
$this->email->to($sendTo);
$this->email->subject($subject);
$this->email->attach(FCPATH . "images/logo.png", "inline");
$content = array(
'HTMLcontent' => $data
);
$body = $this->load->view('email_template.php', $content, TRUE);
$this->email->message($body);
if ($this->email->send()) {
return TRUE;
} else {
return FALSE;
}
}
The FCPATH is ok it shows : /home/myuser/public_html/ and I have images folder inside public_html
email_template.php
<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<table>
<tr>
<td>
<a href="" target="_blank">
<img src="cid:logo.png" width="144" height="76" border="0" alt="logo"/>
</a>
</td>
</tr>
</table>
</body>
</html>
When the email comes it shows with a missing logo as the image below

Invalid Session Flow

I am trying to submit a form by PERL. I have managed to submit the form, but I am getting an HTML page showing "Invalid Session Flow" after the form submission. If I submit from a browser, the new page contains another form.
I couldn't find the reason why that message could come. Is it possible to troubleshoot if I don't have any access on the server side? Or it has to be checked from server side?
My Code:
my $url = "https://MY_URL";
my $Browser = new LWP::UserAgent();
$Browser->ssl_opts(verify_hostname => 0,SSL_verify_mode => 0x00);
my $page = $Browser->get($url);
my $content = HTML::TreeBuilder->new_from_content($page->decoded_content) or die $!;
my $match = $content->find_by_attribute('name' => 'token');
my $token = $match->attr('value');
chomp($token);
my %fileds = ("DATA" => "STD111","token" => $token);
my $Page = $Browser->request(POST $url,\%fileds);
if ($Page->is_success){
print $Page->status_line."\n";
print $Page->content."\n";
}else{
print $Page->status_line."\n";
print $Page->message;
}
Below is the page sources viewed from FireFox
Initial Page:
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=iso-8859-1">
<title>Website Title</title>
</head>
<body>
<form method="post" action="/">
<input type="hidden" name="token" value="5f75b4fb68ed">
<input name="stdname">
<input type="submit" value="Submit">
</form>
</body>
</html>
The output I am getting:
200 OK
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=iso-8859-1">
<title>Website Title</title>
</head>
<body>
<form method="get" action="/">
ERROR: Invalid session flow<br>
<input type="submit" value="Relogin">
</form>
</body>
</html>
The Actual Landing page when submitted via any browser:
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=iso-8859-1">
<title>Website Title</title>
</head>
<body>
<form method="post" action="/">
<input type="hidden" name="token" value="5f75b4fb68ed">
<input type="password" name="stdpass">
<input type="submit" value="Submit">
</form>
</body>
</html>
It's likely that the browser is sending other headers that your LWP program is omitting. When faced by a situation like this, I find the best approach is to use browser plugin I like Live HTTP Headers for Firefox) that traces the actual HTTP transaction and then change my program to get as close to that as possible.

PHP 5.3 write contents to plain text

I am trying to make a PHP script write into a plain text file. I have done this before and it worked just fine. But it's not working this time for some reason.
Here is the HTML I am using:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="/css/feedback.css" >
<title>Questions, Comments, Suggestions</title>
</head>
<body>
<p class="title">Questions, comments, and suggestions here!</p>
<form method="post" name="userFeedback" action="/submit.php">
<textarea id="comments" placeholder="Leave a comment or review here..."></textarea>
<textarea id="name" placeholder="Your name here"></textarea>
<textarea id="contact" placeholder="Put any means of contact you want to here (optional)"></textarea>
<br>
<input class="enter" type="submit" value="Enter">
</form>
</body>
</html>
All I want to do with this is to print out whatever is entered onto a plain .txt file with PHP 5.3. Here is the code:
$data = ($_POST["comments"] ." || ". $_POST["name"] ." || ". $_POST["contact"]);
$data = strip_tags($data);
$file = "feedback.txt";
$f = fopen($file, "a+");
fwrite($f, $data . "\n" . "\n");
fclose($f);
header ( 'Location: index.html' );
Please remember that I am using 5.3. I'm sure there's a simple error in here somewhere. Can someone help me with this? Thank you in advance!
We got it! Turns out that the PHP $_POST method looks for the "name" attribute and not the "id".

Sending email in contact page not working

I am using following code, copied from a website, for a contact page. But I am not getting any emails and the attached files don't find their way to my webserver folder /var/www/. Am I missing something here?
I am running this code on localhost.
email.php
ob_start();
$to = 'baltusaj#gmail.com';
/*$name = $_POST['name'];
$email = $_POST['email'];
$confirm_email = $_POST['confirm_email'];
$subject = $_POST['subject'];
$comments = $_POST['comments'];
$hidden = $_POST['hidden'];
$from = $email;
*/
$keys = array('name', 'email', 'confirm_email', 'subject', 'comments', 'hidden');
foreach($keys as $key)
{
$$key = isset($_POST[$key]) ? $_POST[$key] : null ;
}
print ('
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>Email</title>
<script type="text/javascript">
/*<![CDATA[*/
function progress(){
intWidth = parseInt(document.getElementById("container1").style.width) + 1;
if(intWidth <= 400){
document.getElementById("container1").style.width = intWidth+"px";
}else{
document.getElementById("container1").style.width = 0;
}
setTimeout("progress()",300);
}
/*]]>*/
</script>
</head>
<body>
');
//Make sure email and confirm email are the same
if (!empty ($hidden)) {
if ($email == $confirm_email) {
}else{
$email = '';
$confirm_email = '';
}
}
//Do a reg_ex check on the email
if (!empty ($hidden)) {
$regexp = "^([_a-z0-9-]+)(\.[_a-z0-9-]+)*#([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$";
if (eregi($regexp, $email))
{
}else{
$email = '';
$confirm_email = '';
}
}
// End of email checking
if (empty ($hidden)) {
print ('<div id="container2">
<h1 id="content_h1"><a name="text"> E-mail </a></h1> <p>Please use the following form to e-mail us:</p>
');
include ("form.php");
print ('</div>
<div id="container0" style="display: none;">
<p style="font-size: 15pt; font-family: sans-serif; color:#fd6700; background:#fff;">
Loading...
</p>
<div id="container1" style="width:0px; height:5px; background-color:#fd6700; margin-top:0px; text-align: left;"></div>
<p>Please be patient while your data is processed. This may take a few moments especially if you are uploading a file.</p>
</div>
');
}
if (!empty ($hidden)) {
if ($_FILES['fileatt']['error'] == 1){
print ('<h1 id="content_h1"><a name="text">There has been an error</a></h1>
<p>The maximum file size that can be uploaded using this form is 2 megabytes.
</p>');
}elseif ( (!empty ($name)) && (!empty ($email)) && (!empty ($comments))&& (!empty ($subject))) {
// Get html message content
$form_data = "<p>This email is from <span class=\"bold\">$name</span> \n\n ";
$form_data .= "<p>$comments</p>";
$message = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \n" .
" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"> \n" .
"<html xmlns=\"http://www.w3.org/1999/xhtml\"> \n" .
"<head> \n" .
" <meta http-equiv=\"content-type\" content= \n" .
" \"text/html; charset=iso-8859-1\" /> \n" .
"<style type=\"text/css\"> \n" .
"body { font-size: 9pt; font-family: verdana, sans-serif; color: #000; background:#fff; } \n" .
".bold { font-weight: bold; } \n" .
"</style> \n" .
"</head> \n" .
"<body>$form_data \n" .
"</body> \n" .
"</html> \n\n";
// Obtain file upload vars
$fileatt = $_FILES['fileatt']['tmp_name'];
$fileatt_type = $_FILES['fileatt']['type'];
$fileatt_name = $_FILES['fileatt']['name'];
$headers = "From: $from";
if (is_uploaded_file($fileatt)) {
// Read the file to be attached ('rb' = read binary)
$file = fopen($fileatt,'rb');
$data = fread($file,filesize($fileatt));
fclose($file);
// Generate a boundary string
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
// Add the headers for a file attachment
$headers .= "\nMIME-Version: 1.0\n" .
"Content-Type: multipart/mixed;\n" .
" boundary=\"{$mime_boundary}\"";
// Add a multipart boundary above the html message
$message = "This is a multi-part message in MIME format.\n\n" .
"--{$mime_boundary}\n" .
"Content-Type: text/html; charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$message . "\n\n";
// Base64 encode the file data
$data = chunk_split(base64_encode($data));
//We now have everything we need to write the portion of the message that contains the file attachment. Here's the code:
// Add file attachment to the message
$message .= "--{$mime_boundary}\n" .
"Content-Type: {$fileatt_type};\n" .
" name=\"{$fileatt_name}\"\n" .
"Content-Disposition: attachment;\n" .
" filename=\"{$fileatt_name}\"\n" .
"Content-Transfer-Encoding: base64\n\n" .
$data . "\n\n" .
"--{$mime_boundary}--\n";
}else{
// Generate a boundary string
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
// Add the headers for a file attachment
$headers .= "\nMIME-Version: 1.0\n" .
"Content-Type: multipart/mixed;\n" .
" boundary=\"{$mime_boundary}\"";
// Add a multipart boundary above the html message
$message = "This is a multi-part message in MIME format.\n\n" .
"--{$mime_boundary}\n" .
"Content-Type: text/html; charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$message . "\n\n";
}
//That completes the modifications necessary to accommodate a file attachment. We can now send the message with a quick call to mail:
// Send the message
mail($to, $subject, $message, $headers);
$body = "Dear $name, \n\nThank you for your email. We will contact you as soon as possible regarding the matter. \n \n";
mail ($email, "Re: $subject", $body, 'From:you#your_email.com');
print ('<h1 id="content_h1"><a name="text"> Thank you </a></h1> <p>We will contact you as soon as possible. You will receive an automatic e-mail immediately confirming the reception of your email.</p>');
}else{
print ('<h1 id="content_h1"><a name="text">There has been an error</a></h1> <p>Please fill in all the compulsory fields correctly and then resubmit the form. Thank you.</p>');
include ("form.php");
}
}
// This is the end of the insert
print ('
</div>
</body>
</html>
');
ob_end_flush();
?>
form.php
<div id="form">
<form action="email.php" enctype="multipart/form-data" method="post" onsubmit="
document.getElementById('container0').style.display='';
document.getElementById('container2').style.display='none';
progress();
return true;">
<fieldset id="fieldset">
<label for="name">Contact name<span style="color: red;">*</span>:</label>
<input <?php if (!empty ($hidden)) { if (empty ($name)) { print 'style="background: pink;"'; } } ?> class="form_elements" id="name" type="text" name="name" value="<?php print "$name"; ?>" tabindex="1" />
<br />
<label for="email">E-mail address<span style="color: red;">*</span>:</label>
<input <?php if (!empty ($hidden)) { if (empty ($email)) { print 'style="background: pink;"'; } } ?> class="form_elements" id="email" type="text" name="email" value="<?php print "$email"; ?>" tabindex="1" />
<br />
<label for="confirm_email">Confirm e-mail<span style="color: red;">*</span>:</label>
<input <?php if (!empty ($hidden)) { if (empty ($confirm_email)) { print 'style="background: pink;"'; } } ?> class="form_elements" id="confirm_email" type="text" name="confirm_email" value="<?php print "$confirm_email"; ?>" tabindex="1" />
<br />
<label for="subject">Subject<span style="color: red;">*</span>:</label>
<input <?php if (!empty ($hidden)) { if (empty ($subject)) { print 'style="background: pink;"'; } } ?> class="form_elements" id="subject" type="text" name="subject" value="<?php print "$subject"; ?>" tabindex="1" />
<br />
<label for="comments">Comments<span style="color: red;">*</span>:</label>
<textarea <?php if (!empty ($hidden)) { if (empty ($comments)) { print 'style="background: pink;"'; } } ?>class="form_elements" id="comments" name="comments" cols="19" rows="5" tabindex="1"><?php print "$comments"; ?></textarea>
<br /><br />
<label for="fileatt">Attach document:</label>
<input id="fileatt" type="file" name="fileatt" tabindex="1" />
<br />
<input type="hidden" name="hidden" value="1" /><br />
<label for="submit"><span style="color: red;">*</span> Compulsory fields.</label>
<input id="submit" type="submit" value="Send" tabindex="1" />
</fieldset>
</form>
</div>
For the kajillionth time on this site: Don't build your own mime messages, it's unreliable and painful. Use Swiftmailer or PHPMailer instead. PHP's mail() function is highly unreliable and cannot produce ANY useful diagnostics as to why things are failing. Swift/PHPMailer will both tell you exactly why something blew up.
beyond that, nowhere do you seem to be doing a move_uploaded_file(), so your uploaded files will be auto-deleted by PHP when the script exits. You MUST deal with the files yourself, which means you have to write code to move the files to whatever place you want them stored in.
Are you running an SMTP server on your localhost?

Getting the form to submit/ email

I'm trying to figure this stuff out as I'm going so some expert help and advice would be appreciated. I have a form - using jQuery and Ajax, at the moment I dont know whats working - like if I submit it echos back the data input (only one field - still need to figure out how to add more to the code) but nothing comes through to my email. Am I supposed to link it to some other PHP validation script or can it all be in one place?
Here is a link to the test space: www.bgv.co.za/testspace/contactos.php
Here is the PHP: (my syntax is probably off) - Its a combination of Validation and AJAX stuff - file is called: post.php
<?php
$subject = "Website Contact Form Enquiry";
//If the form is submitted
if(isset($_POST['submit'])) {
//Check to make sure that the name field is not empty
if(trim($_POST['contactname']) == '') {
$hasError = true;
} else {
$name = trim($_POST['contactname']);
}
//Check to make sure sure that a valid email address is submitted
if(trim($_POST['email']) == '') {
$hasError = true;
} else if (!eregi("^[A-Z0-9._%-]+#[A-Z0-9._%-]+\.[A-Z]{2,4}$", trim($_POST['email']))) {
$hasError = true;
} else {
$email = trim($_POST['email']);
}
//Check to make sure comments were entered
if(trim($_POST['message']) == '') {
$hasError = true;
} else {
if(function_exists('stripslashes')) {
$comments = stripslashes(trim($_POST['message']));
} else {
$comments = trim($_POST['message']);
}
}
//If there is no error, send the email
if(!isset($hasError)) {
$emailTo = 'info#bgv.co.za'; //Put your own email address here
$body = "Name: $name \n\nEmail: $email \n\nComments:\n $comments";
$headers = 'From: My Site <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email;
mail($emailTo, $subject, $body, $headers);
$emailSent = true;
}
}
sleep(3);
if (empty($_POST['email'])) {
$return['error'] = true;
$return['msg'] = 'You did not enter you email.';
}
else {
$return['error'] = false;
$return['msg'] = 'You\'ve entered: ' . $_POST['email'] . '.';
}
echo json_encode($return);
?>
Here is the JS file (Called: ajaxSubmit)
$(document).ready(function(){
$('#submit').click(function() {
$('#waiting').show(500);
$('#contactform').hide(0);
$('#message').hide(0);
$.ajax({
type : 'POST',
url : 'post.php',
dataType : 'json',
data: {
email : $('#email').val()
},
success : function(data){
$('#waiting').hide(500);
$('#message').removeClass().addClass((data.error === true) ? 'error' : 'success')
.text(data.msg).show(500);
if (data.error === true)
$('#contactform').show(500);
},
error : function(XMLHttpRequest, textStatus, errorThrown) {
$('#waiting').hide(500);
$('#message').removeClass().addClass('error')
.text('There was an error.').show(500);
$('#contactform').show(500);
}
});
return false;
});
});
and here is the HTML DOC:
<?php
/**
* #author Brett Vorster <www.kreatif.co.za>
*/
?>
<!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" />
<meta name="description" content="Orchard Systems 2012 Symposium Register Here" />
<meta name="keywords" content="Orchard Systems, Fruit Growers" />
<title>Orchard Systems 2012 | Contact Form</title>
<link rel="stylesheet" type="text/css" media="all" href="css/style.css" />
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" media="all" href="css/styleie7.css" />
<![endif]-->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
<script src="jquery.validate.pack.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#contactform').validate({
showErrors: function(errorMap, errorList) {
//restore the normal look
$('#contactform div.xrequired').removeClass('xrequired').addClass('_required');
//stop if everything is ok
if (errorList.length == 0) return;
//Iterate over the errors
for(var i = 0;i < errorList.length; i++)
$(errorList[i].element).parent().removeClass('_required').addClass('xrequired');
},
submitHandler: function(form) {
$('h1.success_').removeClass('success_').addClass('success_form');
$("#content").empty();
$("#content").append("<div id='sadhu'>This is just plain text. I need me a variable of somethink</div>");
$('#contactform').hide();
var usr = document.getElementById('contactname').value;
var eml = document.getElementById('email').value;
var msg = document.getElementById('message').value;
document.getElementById('out').innerHTML = usr + " " + eml + msg;
document.getElementById('out').style.display = "block";
form.submit();
}
});
});
</script>
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico">
</head>
<body class="contact">
<div id="container">
<div class="sidebar">
<img src="images/orchardsystems2012.png" title="Orchard Systems 2012 Logo" />
<div class="data"><p>
10th International<br/>Symposium on<br/>Orchard Systems</p></div>
<div class="location"><p>
Stellenbosch<br/>South Africa<br/><span>3 - 6 December</span><br/>2012</p>
</div><a><img class="button" src="images/button_interested.png" title="I am interested - keep me informed" /></a>
<img class="button" src="images/button_attend.png" title="I want to attend - registration form" />
<a href="abstract.html" title="Click here to submit an abstract" ><img class="button" src="images/button_abstract.png" title="I want to take part - submit an abstract" /></a>
<img src="images/ishslogo.gif" style="margin:45px 63px 0px 63px;" />
</div>
<div id="intainer">
<div id="menu">
<ul>
<li><a href="index.html" tabindex="i" title="Orchard Systems 2012 | Home" >Home</a></li>
<li><a href="aboutus.html" tabindex="au" title="About Us" >About Us</a></li>
<li><a href="programme.html" tabindex="p" title="Programme" >Programme</a></li>
<li><a href="registration.html" tabindex="r" title="Registration Form" >Registration</a></li>
<li><a href="venue.html" tabindex="v" title="Venue" >Venue</a></li>
<li><a href="accommodation.html" tabindex="a" title="Accommodation" >Accommodation</a></li>
<li>Tours</li>
<li class="current">Contact</li>
</ul>
</div>
<div class="header">
<h3 class="pagetitle">Contact</h3>
</div>
<div id="content">
<p class="general_site">If you want to be kept in the loop please send us your details and we will update you. Suggestions for workshops are welcome.</p>
<div id="message" style="display: none;">
</div>
<div id="waiting" style="display: none;">
Please wait<br />
<img src="images/ajax-loader.gif" title="Loader" alt="Loader" />
</div>
<form action="" id="contactform" method="post">
<fieldset>
<legend>Demo form</legend>
<div class="_required"><label for="name">Name*</label><input type="text" size="50" name="contactname" id="contactname" value="" class="required" /></div><br/><br/>
<div class="_required"><label for="email">E-mail address*</label><input type="text" size="50" name="email" id="email" value="" class="required email" /></div><br/><br/>
<label for="message">Message</label><textarea rows="5" cols="50" name="message" id="message" class="required"></textarea><br/>
<div class="checko"><input type="checkbox" class="check" name="ISHS Member"/><label class="right" for="message">I am interested in a pre-symposium tour</label></div>
<input type="submit" value="submit" name="submit" id="submit" />
</fieldset>
</form>
<p class="general_site">Or you can contact Retha Venter on +27 82 6567088 or reventer#netactive.co.za</p>
</div>
</div>
</div>
<div id="footer">
<div class="footer_content">
<div class="copyright"><a href="http://www.kreatif.co.za" target="_blank" title="website designed and developed by Kreatif Code.Design">© Orchard Systems 2012<br/>
Designed by kreatif.co.za</a></div>
<span class="contactno">Tel +27 21 000 0000</span>
<span class="emailus">info#orchardsystems2012.co.za</span>
</div>
</div>
<script type="text/javascript" src="js/ajaxSubmit.js"></script>
</body>
</html>
Please help me, I've spent the whole weekend trying to find a way to do this. Everytime I feel like I get somewhere and it amounts to nothing... I'm no programmer I dont understand how all of this works but I am learning and just really need to know how to do it. Thank you
Sorted by adding this to the PHP file >
//If there is no error, send the email
if(!isset($hasError)) {
$emailTo = 'info#bgv.co.za'; //Put your own email address here
$body = "Name: $name \n\nEmail: $email \n\nComments:\n $comments";
$headers = 'From: My Site <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email;
mail($emailTo, $subject, $body, $headers);
$emailSent = true;
}
and this >
$subject = "Website Contact Form Enquiry";
$return['error'] = false;
$name = trim($_POST['name']);
$email = trim($_POST['email']);
$comments = trim($_POST['message']);
hey looks like I'm learning how this stuff works!