How to embed HTML using PHP when sending an Email

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
sree78
Forum Commoner
Posts: 39
Joined: Tue May 20, 2003 11:38 am

How to embed HTML using PHP when sending an Email

Post by sree78 »

Hi there,

I am a newbie to PHP. I was working with coldfusion before and due to budget constraint, we have moved to PHP (Way to go)..

My question would be
------------------------
I have a form where people will fill up their details like for an example:-

FirstName
LastName
Address
Phone
Email

Once they have filled up, these option, they will then click the submit button which will then send the details to our office through email. I am wondering how can I embed HTML in my processing page and pass the variables. Like for an example, to have the details showup in a table layout.

I have been looking at a lot books including Oreilly, but got nothing much and i would really appreciate any feedback.

Thanks :?
SBukoski
Forum Contributor
Posts: 128
Joined: Wed May 21, 2003 10:39 pm
Location: Worcester, MA

Post by SBukoski »

Send the Content Type in the header of your e-mail when using the mail function. For example:

Code: Select all

mail($email, $subject, $bodytext, "Content-type: text/html; charset=iso-8859-1\r\n");
Then in your bodytext you just plug away as if it were a normal HTML file. Use yur <table> tags and everything else you need.
Post Reply