Gilbert Posted March 23, 2016 Share Posted March 23, 2016 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 GilbertThank you so much for visiting our stand at The Bridal Expo. 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 http://www.shiftingsands.co.za </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(); } ?> Quote Link to comment Share on other sites More sharing options...
maxxd Posted March 23, 2016 Share Posted March 23, 2016 Check out PHPMailer. Quote Link to comment Share on other sites More sharing options...
Barand Posted March 23, 2016 Share Posted March 23, 2016 You need to include an email header to tell it that the content is HTML Quote Link to comment Share on other sites More sharing options...
PravinS Posted March 25, 2016 Share Posted March 25, 2016 Also avoid adding <html>, <head>, <title>, <body> tags, just add <body> tag content in mail body 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.