blastbum Posted February 27, 2009 Share Posted February 27, 2009 Hi, The emails that are getting sent from the contact page (http://www.nobleboatsinternational.com/contactus.php) are appearing in HTML. I want the emails to display the information from the contact form in readable text, but for some reason, it is appearing in HTML code (see below): <html> <head> <title>Contact form</title> </head> <body> <table> <tr> <th width="200">First Name</th><td>Test</td> </tr> <tr> <th>Last Name</th><td>Test</td> </tr> <tr> <th>Email</th><td>[email protected]</td> </tr> <tr> <th>Country</th><td>Australia</td> </tr> <tr> <th>ZIP</th><td>2065</td> </tr> <tr> <th>Enquiry</th><td>This one should work.</td> </tr> </table> </body> </html> The PHP code on the contact page is the following: <? }else{ //phpinfo(INFO_VARIABLES);die; /* $_POST["first_name"] $_POST["last_name"] $_POST["email"] $_POST["country"] $_POST["zip"] $_POST["enquiry"] */ // Multiple recipients $para = 'enquiries@domain_hidden.com'; // asunto $asunto = 'Contact from Contact Us form from Blah Blah Company'; // mensaje $mensaje = ' <html> <head> <title>Contact form</title> </head> <body> <table> <tr> <th width="200">First Name</th><td>'.$_POST["first_name"].'</td> </tr> <tr> <th>Last Name</th><td>'.$_POST["last_name"].'</td> </tr> <tr> <th>Email</th><td>'.$_POST["email"].'</td> </tr> <tr> <th>Country</th><td>'.$_POST["country"].'</td> </tr> <tr> <th>ZIP</th><td>'.$_POST["zip"].'</td> </tr> <tr> <th>Enquiry</th><td>'.$_POST["enquiry"].'</td> </tr> </table> </body> </html> '; // Para enviar correo HTML, la cabecera Content-type debe definirse $cabeceras = 'MIME-Version: 1.0' . "\r\n"; $cabeceras .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Cabeceras adicionales $cabeceras .= 'To: enquiries <enquiries@domain_hidden.com>' . "\r\n"; $cabeceras = 'From:' .$_POST['email']; // Enviarlo if(mail($para, $asunto, $mensaje, $cabeceras)){ ?> Can anyone help me fix this? I would really appreciate it, if you could help me out ASAP. Thank you. Many thanks, Dan Link to comment https://forums.phpfreaks.com/topic/147135-email-sent-from-contact-page-is-appearing-in-html-instead-of-readable-text/ Share on other sites More sharing options...
shadiadiph Posted February 27, 2009 Share Posted February 27, 2009 hi try this I sorry not sure which language that is in spanish? you are trying to get your server to sendmail from the users server maybethe users servier will not allow this so use another email address for the from field on your website. in the code below i used info <? $firstname = $_POST["first_name"] $lastname = $_POST["last_name"] $email = $_POST["email"] $country = $_POST["country"] $zip = $_POST["zip"] $enquiry = $_POST["enquiry"] header("Location: thankyou.php; $to = "enquiries@domain_hidden.com"; $subject = "Contact from Contact Us form from Blah Blah Company"; $MsgHeader = "From: WEBSITE NAME <info@domain_hidden.com>\n"; $MsgHeader .= "MIME-Version: 1.0\n"; $MsgHeader .= "Content-type: text/html; charset=iso-8859-1\n"; $MsgBody = " <html> <head> <title>Contact form</title> </head> <body> <table> <tr> <th width='200'>First Name</th><td>$firstname</td> </tr> <tr> <th>Last Name</th><td>$lastname</td> </tr> <tr> <th>Email</th><td>$email</td> </tr> <tr> <th>Country</th><td>$country</td> </tr> <tr> <th>ZIP</th><td>$zip</td> </tr> <tr> <th>Enquiry</th><td>$enquiry</td> </tr> </table> </body> </html> "; mail($to, $subject, $MsgBody, $MsgHeader); exit; ?> Link to comment https://forums.phpfreaks.com/topic/147135-email-sent-from-contact-page-is-appearing-in-html-instead-of-readable-text/#findComment-772476 Share on other sites More sharing options...
shadiadiph Posted February 27, 2009 Share Posted February 27, 2009 if that doesn't work try changing each <th></th> to <td></td> html email only allow limited formatting Link to comment https://forums.phpfreaks.com/topic/147135-email-sent-from-contact-page-is-appearing-in-html-instead-of-readable-text/#findComment-772480 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.