[Solved] Email format

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ethoemmes
Forum Commoner
Posts: 26
Joined: Thu Aug 18, 2005 4:11 pm

[Solved] Email format

Post by ethoemmes »

Hi

I am using the below code to send comments entered onto my website. The code is working correctly but the format of the message is not write. I have pasted the code and a copy of the email I receive below. As you can see all text after the first line is tabbed.

Does anyone know what I have done wrong?


Code: Select all

<?php

$Title = $_POST['Title'];
$FirstName = $_POST['FirstName'];
$LastName = $_POST['LastName'];
$Email = $_POST['Email'];
$Comments = $_POST['Comments'];

$strMailTo = 'Edgar@rrbltd.com';
$strSubject = 'Enquiry from Website';
$strBody = "Enquiry received from http://www.rrbltd.com \n
           $Comments \n
           Received from \n
           $Title $FirstName $LastName \n
           $Email";

$From = "From: \"$FirstName $LastName\" <$Email>\nX-Mailer: PHP/" . phpversion();

mail ($strMailTo, $strSubject, $strBody, $From);

?>

Enquiry received from http://www.rrbltd.com

Thsi is a test comment

Received from

Mr Edgar Thoemmes

ethoemmes@gmail.com
TIA
wyred
Forum Commoner
Posts: 86
Joined: Mon Dec 20, 2004 1:59 am
Location: Singapore

Post by wyred »

I think you need to use \t if you want tabs.
Post Reply