Page 1 of 1

Form Email Output styling

Posted: Mon Jul 14, 2014 4:21 am
by gt11990
I have created a html form which i inserted into my webpage and have done a php file to send me the details entered into the from via email however,

i don't receive a email
and

i would like to receive the results with html formatting.
I have looked everywhere to try find a solution but did not find one.

Could someone please help please i am really really stuck.

Thank You

My HTML code

Code: Select all

<form method="post" action="/form/php/sendresults.php">
<label>First Name:  <input type="text" name="firstname" size="30" maxlength="30" />   
   </label>
<label>Last Name:  <input type="text" name="lastname" size="30" maxlength="30" />   
   </label>
<textarea name="comments" rows="8" cols="50"  style="margin-left:37px" />
</textarea>
 <input type="submit" value="submit"  />
</form>

Code: Select all

 <?php
$to = 'info@my.com';
$subject = $firstname;
$message = '
<html>
<head>
<title>'.$firstname.'</title>
</head>
<body>
<p>'.$firstname.'!</p>
<table>
<tr>
<th>Full Name</th><th>Company Name</th><th>Company Registered Number</th><th>Phone Number</th>
</tr>
<tr>
<td>'.$lastname.'</td><td>'.$comments.'</td><td>'.$firstname.'</td><td>'.$firstname.'</td>
</tr>
</table>
</body>
</html>
';
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
mail($to, $subject, $message, $headers);
?>

Re: Form Email Output styling

Posted: Mon Jul 14, 2014 6:01 am
by Celauran
At a glance, it looks fine. Have you checked your mail server's logs to ensure the mail is being sent? Not receiving it and it not being sent at all are two entirely separate problems.

Re: Form Email Output styling

Posted: Mon Jul 14, 2014 7:55 am
by gt11990
problem is if i try just a simple form it sends the mail however once i code it so it outputs a html format i do not receive any emails this is the weird thing.

Re: Form Email Output styling

Posted: Mon Jul 14, 2014 8:23 am
by Celauran
So the mail server log shows the message as having been sent?

Re: Form Email Output styling

Posted: Tue Jul 15, 2014 3:01 am
by gt11990
Yes that is whats happening