PDA

View Full Version : Html Email no longer working



jimjiminyjimjim
August 14th, 2007, 04:42 PM
I put together an email enquiry form that sends and email from variables posted from a flash form, its kind of a mish mash of tutorials including from the kirupa tutorial.

It used to work when I was on a Windows based server, now it has moved to a Linux based server. The html text format no longer works. It looks like this now:

<p><b>Company:</b>*****Some text*****</p><p><b>Telephone:</b>51-1-****6120</p><p><b>Enquiry:</b>*****Some comment*******</p>

Why does it not format the text on a linux server. Whats wrong???? Is there something I need to change in the server settings that i've forgotten?

Heres the code:





<?php

$to = '*******@gmail.com' . ', '; // note the comma

$message = $_POST["message"];
$telephone = $_POST["telephone"];
$company = $_POST["company"];

// subject
$subject = 'Inquiry';

// message


$mail = "<p><b>Company:</b>" . $company . "</p>" . "<p><b>Telephone:</b>" . $telephone . "</p>" . "<p><b>Enquiry:</b>" .$message . "</p>";

$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
$headers .= "From: " . $_POST["name"] . "<" . $_POST["email"] .">\r\n";
$headers .= "Reply-To: " . $_POST["email"] . "\r\n";
$headers .= "Return-path: " . $_POST["email"];


// Mail it
mail($to, $subject, $mail, $headers);

?>



Any help much appreciated.

Syous
August 14th, 2007, 05:05 PM
Just use this one, change the variables to be equal to yours. I also would use $msg instead of $mail, jsut to be safe.

<?

$sendTo = "****@gmail.com";
$subject = "Contact Request";

$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$message = $_POST['message'];
$service = $_POST['service'];
$month = $_POST['month'];
$day = $_POST['day'];
$year = $_POST['year'];
$preferred = $_POST['preferred'];






$headers = "From: ". $name . "<" . $email . ">\r\n";

$headers .= "Reply-To: " . $_POST["email"] . "\r\n";

$headers .= "Return-path: " . $_POST["email"];


$msg = "\r\nName: " .$name;
$msg .= "\r\nPhone: " .$phone;
$msg .= "\r\neMail: " .$email;
$msg .= "\r\r\nMessage: " .$message;
$msg .= "\r\r\nService: " .$service;


mail($sendTo,$subject,$msg,$headers);
?>

jimjiminyjimjim
August 14th, 2007, 05:15 PM
Thanks for the post.

Does this send an html email? I really need to be able to format the text with bold tags. I couldn't see anything that made it html.

Syous
August 14th, 2007, 05:18 PM
This is just the php, not the html. You're going to have to create the input fields via html and set them accordingly.

jimjiminyjimjim
August 14th, 2007, 05:27 PM
Sorry, I think you misunderstood my post - I don't think I was too clear.

I want the email that is sent to be html, my form fields are flash.

I really wanted the parts that say Telephone:****** or Message:****** to be in bold using the <b> html tag.

Syous
August 14th, 2007, 05:34 PM
Ohh...yea I don't know about that offhand sorry =p

jimjiminyjimjim
August 14th, 2007, 05:44 PM
Anyone got any ideas??? :-)

simplistik
August 14th, 2007, 06:34 PM
Should work fine, though I'd definately change


iso-8859-1

to


utf-8

outside of that the only thing I can recommend doing is gettin rid of the MIME type.

jimjiminyjimjim
August 14th, 2007, 06:59 PM
Excellent thats sorted most of it out. This is the email message I now get:

From: John Smith Reply-To: johnsmith@hotmail.com Message-Id: <20070814232647.56AF213DCB@aiso.net> Date: Tue, 14 Aug 2007 16:26:47 -0700 (PDT)
Company:Test Company

Telephone:0983092834

Enquiry:tesfsdfsdfs


The repy or sender email is not passed on so it doesn't appear when you click reply to:

Whats causing this???