PDA

View Full Version : Formatting text in formail


SDP2006
07-03-2003, 02:24 AM
Is there a way to format the text (font, color, size) in a message that has been sent by a PHP form?


Thanks

Nightfire
07-03-2003, 03:42 AM
$headers = "From: daemon@yourdomain.com\n"; // Who the email was sent from
$headers .= "cc: SOMEONE@SOMEWHERE.COM\n"; // If you want to CC: someone the same mail
$headers .= "Content-Type: text/html; charset=iso-8859-1\n"; // IMPORTANT: This is where the mail is declared to have HTML content
$headers .= "Reply-To: $email\n"; // Reply to address
$headers .= "X-Priority: 1\n"; // The priority of the mail
$headers .= "bcc: ANOTHERSOMEONE@SOMWHERELSE.COM"; // If you want to BCC: someone the same mail


mail($recipient,$subject,$content,$headers);


In $content you'd just format the text the html way as you'll be sending a html email

SDP2006
07-03-2003, 01:58 PM
So with that $content header, it will be able to read HTML?

Nightfire
07-03-2003, 02:01 PM
content is the message you're sending...

$content = "stuff to be sent in email <font face='verdana' size='30'>formatted text</font>";

ConfusedOfLife
07-03-2003, 02:18 PM
An easy way to make your content is by using ob_start. This function is a kind of flush that gets everything between the start and the end tags, and then you can send the content to a function. This function can be your mailing function!

Well, to clear things up, You can easily get the submitted form, and write the info in your page, the way that you always used to do it. Then after making the html form with the sent data, you can put ob_start at the beginning and then ob_end at the end of your html content. It doesn't print out anything, but gives you the whole html thing in a variable. Then you can mail that variable! For getting the syntax of using ob_start, look up the manuals!