Jump to content

Recommended Posts

Please help ... I am rather new on php coding, I need some help regarding html rich mail... IThis is the output i am getting

<html><head><title>email message</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head><body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"><img src="/images/logo.jpg" />Dear Gilbert

Thank you so much for visiting our stand at The Bridal Expo.

cleardot.gif

This is my script

<?php
  session_start();
  ob_start();
 // Get values from form
$name = $_SESSION['name'];
$surname = $_SESSION['surname'];
$function_date = $_SESSION['function_date'];
$telephone = $_SESSION['telephone'];
$details = $_SESSION['details'];
$email = $_SESSION['email'];
/* Set e-mail recipient */
$myemail  = "info@shiftingsands.co.za";
$myemail2  = "admin@shiftingsands.co.za";
 
 
echo "email page";
/* Check all form inputs using check_input function */
$yourname = check_input($name, "Enter your name");
$subject  = "Thank you for your response";
$subject2  = "Response";
//$email    = check_input($email);
$comments = "Write your comments";
 
/* If e-mail is not valid show error message */
if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email))
{
    show_error("E-mail address not valid");
}
 
/* If URL is not valid set $website to empty */
if (!preg_match("/^(https?:\/\/+[\w\-]+\.[\w\-]+)/i", $website))
{
    $website = '';
}
 
/* Let's prepare the message for the e-mail */
$message = '<html><head><title>email message</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head><body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">';
$message .= '<img src="/images/logo.jpg" />';
$message .= "Dear $yourname
 
Thank you so much for visiting our stand at The Bridal Expo. 
 
Please feel free to contact us for an appointment or if you have any questions regarding your wedding garments.
 
Details Inserted
------------------
Name: $name
Surname: $surname
E-mail: $email
Function Date: $function_date
Telephone: $telephone
 
Kind Regards
Sanette  Van Schalkwyk
0794960747
</body></html>
";
 
/* Let's prepare the message for the e-mail */
$message2 = "Hello
 
Feedback received
 
Name: $name
Surname: $surname
E-mail: $email
Function Date: $function_date
Telephone: $telephone
 
End of message
";
/* Send the message using mail() function */
mail($email, $subject, $message);
mail($myemail, $subject2, $message2);
mail($myemail2, $subject2, $message2);
/* Redirect visitor to the thank you page */
header('Location: ../thankyou.php');
exit();
 
/* Functions we used */
function check_input($data, $problem='')
{
    $data = trim($data);
    $data = stripslashes($data);
    $data = htmlspecialchars($data);
    if ($problem && strlen($data) == 0)
    {
        show_error($problem);
    }
    return $data;
}
 
function show_error($myError)
{
?>
    <html>
    <body>
 
    <b>Please correct the following error:</b><br />
    <?php echo $myError; ?>
 
    </body>
    </html>
<?php
exit();
}
?>
Link to post
Share on other sites
This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.