Hi.
I am using an email script on my page to allow me to send an email to someone giving them details of their online voucher... if you goto http://www.350finale.co.nz/admin/email.php you will see what I mean.
The problems I am having is
a) the from field when the email is sent comes up with some weird address example@example.com, is there anyway I can make it so it will say something like Finale Restaurant instead??
b) the conditions text area is not sending data to the preview screen, or to email, yet the email message text area is, and I cant see any difference between them??
and c) When the email is sent to the user, it is sent in text not html... I am wanting it to produce a sort of box in the email with their voucher details something like this
|-------------------------------------|
| Voucher Details |
| |
| Name: blah blah |
|-------------------------------------|
Is there some way I can do this, without the right hand side being skewed?? as the voucher details will be different lengths of each one, hence it moves the rhs outwards and inwards depending on the length of the field... does that make sense??
Any help on any of these matters would be greatly appreciated.
Cheers
here is my code!
email.php
<form action="email-verify.php" method="post">
<p>Send Email To:</p> <input type="text" name="emailName">
<p> </p>
<p>Email Address:</p> <input type="text" name="sendEmailTo">
<p> </p>
<p>Enter Voucher Number:</p><input type="text" name="voucherNumber">
<p> </p>
<p>Date voucher was issued: </p><input type="text" name="issuedDate">
<p> </p>
<p>Date voucher expires: </p><input type="text" name="expiryDate">
<p> </p>
<p>Voucher was issued by: </p><input type="text" name="issuedBy">
<p> </p>
<p>Conditions that relate to this voucher:</p><textarea name="conditions" rows="5" cols="50"></textarea>
<p> </p>
<p>Email Message:</p><textarea name="emailMessage" rows="5" cols="50"></textarea>
<p> </p>
<input type="submit" name="Submit" value="Preview Email">
</form>
email-verify.php
<?php
$verified = "no";
if (isset($_POST['v']))
$verified = $_POST['v'];
if ($verified == "no") {
$todayis = date("d.m.Y");
$emailName = $_POST['emailName'];
$sendEmailTo = $_POST['sendEmailTo'];
$voucherNumber = $_POST['voucherNumber'];
$issuedDate = $_POST['issuedDate'];
$expiryDate = $_POST['expiryDate'];
$issuedBy = $_POST['issuedBy'];
$conditions = $_POST['conditions'];
$emailMessage = $_POST['emailMessage'];
echo "please check the details before clicking send!<br /><br />";
print "Date: $todayis<br /><br />";
print "Send Email to: <font color=\"red\">$emailName</font><br />";
print "Email Address: <font color=\"red\">$sendEmailTo</font><br /><br>";
print "Voucher Number: <font color=\"red\">$voucherNumber</font><br />";
print "Date Issued: <font color=\"red\">$issuedDate</font><br />";
print "Expiry Date: <font color=\"red\">$expiryDate</font><br />";
print "Voucher Issued by: <font color=\"red\">$issuedBy</font><br />";
print "Conditions on this voucher: <font color=\"red\"$conditions</font><br /><br />";
print "Message: <font color=\"red\">$emailMessage</font><br />";
?>
<form name="verify" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<p> </p>
If you need to change something: <button name="back" type="button" onclick="javascript: history.go(-1)">Go Back</button><br>
<p> </p>
If all details are correct, click send! <input type="submit" name="submit" value="Send Email" />
<input type="hidden" name="v" value="yes">
<input type="hidden" name="date" value="<?php echo $todayis; ?>">
<input type="hidden" name="emailName" value="<?php echo $emailName; ?>" />
<input type="hidden" name="sendEmailTo" value="<?php echo $sendEmailTo; ?>">
<input type="hidden" name="voucherNumber" value="<?php echo $voucherNumber; ?>">
<input type="hidden" name="issuedDate" value="<?php echo $issuedDate; ?>" />
<input type="hidden" name="expiryDate" value="<?php echo $expiryDate; ?>" />
<input type="hidden" name="issuedBy" value="<?php echo $issuedBy; ?>" />
<input type="hidden" name="conditions" value="<?php echo $conditioins; ?>">
<input type="hidden" name="emailMessage" value="<?php echo $emailMessage; ?>" />
</form>
<?php
} // End if(!$verified
if ($verified == "yes") {
$date = $_POST['date'];
$emailName = $_POST['emailName'];
$sendEmailTo = $_POST['sendEmailTo'];
$voucherNumber = $_POST['voucherNumber'];
$issuedDate = $_POST['issuedDate'];
$expiryDate = $_POST['expiryDate'];
$issuedBy = $_POST['issuedBy'];
$conditions = $_POST['conditions'];
$emailMessage = $_POST['emailMessage'];
$sendto = "$sendEmailTo";
$subject = "Finale Voucher";
$notes = "";
$headers="";
$headers .="test form \n\n";
$headers .="Datum: $date \n";
$headers .="Congratulations $emailName, \n\n";
$headers .="Here is your voucher. \n\n";
$headers .= "|-------------------------------------------------------------------------------------------------------| \n";
$headers .= "| YOUR VOUCHER DETAILS: | \n";
$headers .= "| --------------------- | \n";
$headers .= "| | \n";
$headers .= "| Name on Voucher: $emailName | \n";
$headers .= "| Email Address: $sendEmailTo | \n";
$headers .= "| | \n";
$headers .= "| Voucher Number: $voucherNumber (Please quote this number when making your booking.) | \n";
$headers .= "| Date Issued: $issuedDate Expiry Date: $expiryDate | \n";
$headers .= "| | \n";
$headers .= "| Conditions of this voucher: $conditions | \n";
$headers .= "| | \n";
$headers .= "|-------------------------------------------------------------------------------------------------------| \n\n";
$headers .= "$emailMessage \n";
mail($sendto, $subject, $notes, $headers);
echo "Thanks! Mail was sent.";
}
exit; // stop the script
?>