This script inserts the details into the database but does not send the email - if im sending an email with no attachments then what would the headers be like?
Or, suggest why this is not working.
<?php
session_start();
// Get the PHP file containing the DbConnector class
require('db/DbConnector.php');
// Create an instance of DbConnector
$connector = new DbConnector();
//=================================================
$name = $_POST['name'];
$email = $_POST['email'];
$address_1 = $_POST['address_1'];
$address_2 = $_POST['address_2'];
$address_3 = $_POST['address_3'];
$city = $_POST['city'];
$county = $_POST['county'];
$postcode = $_POST['postcode'];
/* mail setup recipients, subject etc */
$recipients = "***@***.com";
$from = "***@***.co.uk";
$headers = "From: $from\n";
$Subject = "hello";
$mailmsg = "Hello, here are the details for this order:<br><br>
Name: $name<br>
Email: $email<br>
Address 1: $address_1<br>
Address 2: $address_2<br>
Address 3: $address_3<br>
City: $city<br>
County: $county<br>
Postcode: $postcode<br><br>
Thanks";
$connector->query("INSERT INTO table SET id = '', name = '$name', email = '$email', address_1 = '$address_1', address_2 = '$address_2', address_3 = '$address_3', city = '$city', county = '$county', postcode = '$postcode'");
if(@mail($email, $subject, $mailmsg, $headers))
{
$_SESSION['done'] = "seya.";
session_write_close();
header('Location: catalog.php');
}
?>
Thanks anyone