artstarved Posted March 9, 2009 Share Posted March 9, 2009 I am trying to format this code so that it does not dump all of the text from different inputs into one garbled mess in the e-mail message. To do this I am trying to use html to add a header and line break so that the emails is formatted but it is just spitting my html out like it is plain text when I open the e-mail. Tags and all. If anyone can help that would be great, I am pretty new to PHP. Here is my PHP: <?php //Organization Name $mail_from="$organization"; //Organization Telephone $message.="$organization_phone"; //Organization Mail $message.="$organization_mail"; //General Inquiries $message.="$general_inquires"; // From $header="from: $organization <$mail_from>"; // Enter your email address $to ='[email protected]'; // Variables $message.=$var1.'<p>organization phone number</p><br>'.$var2.'<p>organization email</p><br>'.$var3.'<p>general inquiries</p><br>'; // Send Form $send_contact=mail($to,$subject,$message,$header); // Check, if message sent to your email // display message "We've recived your information" if($send_contact){ echo "We've recived your contact information"; } else { echo "ERROR"; } ?> Link to comment https://forums.phpfreaks.com/topic/148550-formatting-php-form-to-email/ Share on other sites More sharing options...
mrdamien Posted March 9, 2009 Share Posted March 9, 2009 <?php //Organization Name $mail_from="$organization"; //Organization Telephone $message.="$organization_phone"; //Organization Mail $message.="$organization_mail"; //General Inquiries $message.="$general_inquires"; // From $header="From: $organization <$mail_from>\n". "Content-type: text/html"; // Enter your email address $to ='[email protected]'; // Variables $message.=$var1.'<p>organization phone number</p><br>'.$var2.'<p>organization email</p><br>'.$var3.'<p>general inquiries</p><br>'; // Send Form $send_contact=mail($to,$subject,$message,$header); // Check, if message sent to your email // display message "We've recived your information" if($send_contact){ echo "We've recived your contact information"; } else { echo "ERROR"; } ?> You gotta specify Content-type in the headers. Link to comment https://forums.phpfreaks.com/topic/148550-formatting-php-form-to-email/#findComment-780115 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.