View Full Version : Bold and tabs
11-27-2006, 06:25 PM
I am retrieving inputs from a form and then in my php script, I am concatenating these and using them to create the body argument for the "mail" command. I would like text like "EMAIL", "ADDRESS LINE" to be bold and also to have tabs in the email- please can anyone help? The code from the script is as below:
$name = $_REQUEST[name] ;
$email = $_REQUEST[email] ;
$address_1 = $_REQUEST[address_1] ;
$body = "NAME: $name
ADDRESS LINE 1:\t\t $address_1\n"
$sent = mail($to, $subject, $body, $headers) ;
I have already tried \t, but that doesn't seem to put any tabs in.
Any help would be great :)
11-27-2006, 08:16 PM
I think what you're trying to do, or should do, it use HTML email instead
of plain text. Most people allow their email clients to view HTML email.
The PHP script below is an example. If they don't allow HTML emails, it
will default to text only. But this allows you to format your message.
Put in your email address ( "to" ) and see what it looks like.
You'll then have to program in the variables from your form, as this example
has hard-coded variables (just for testing).
$subject="This is an email test";
$address="123 Elm Street";
//redirect. where to go after sending email (like a thankyou page)
// Now append $eol variable with header
$headers = "From: ".stripslashes($from)." <".stripslashes($from_email).">".$eol;
//specify MIME version 1.0
$headers .= "MIME-Version: 1.0".$eol;
$boundary = md5(uniqid(time()));
//tell e-mail client this e-mail contains//alternate versions
$headers .= "Content-Type: multipart/alternative" .
"; boundary =".$boundary.$eol;
//message to people with clients who don't understand MIME
$headers .= "This is a MIME encoded message.".$eol;
//HTML version of message
$headers .= "--".$boundary.$eol .
"Content-Type: text/html; charset=ISO-8859-1".$eol .
mail(stripslashes($to), stripslashes($subject), stripslashes($mailcontent), $headers);
// Go to thankyou page...
header ("location: $redirect");
11-27-2006, 10:42 PM
Thank you very much ... was wondering if there is an alternative, if I didn't want to use html?
11-28-2006, 02:39 AM
No alternative that I know of.
Not all email clients are the same, and there are
many revisions of various clients like Outlook O/Express.
Try HTML for a while with various people and see what they think.
You'll end up liking the flexibility, and if people read their email
online, you can include graphic images also. People who read their
email off-line ... of course can't access images.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.