Forum Moderators: coopster
mail(strTo, strSubject, strMessage);
I would like $strMessage to be in HTML. I have many variables from a form that the user fills in. I don't simply want to list off the values of these variables with no formatting. I would like to put them all in an HTML table that organizes the information in the Inbox. How do I do this?
Thanks!
You coould take a look at this thread, though it just uses a text email
Basics of Submitting and Emailing Forms with PHP [webmasterworld.com]
as far as making it html email have you tried just building your html and putting it into your message var?
it seems you know the basics of php so I hope you will be able to make out from this code. Sorry i cant write comments in the code for lack of time:
<?php
$body = "<b>" . $_POST['name'] . "</b>"
$subject = "my first html mail";
$sent = @mail('', $subject, $body,
"To: "Myname<myemail@mydomain.com>\n" .
"From: sender name<sender@gmail.com>\n" .
"MIME-Version: 1.0\n" .
"Content-type: text/html; charset=iso-8859-1");
?>
prepare the body of the mail in $body as
$body = "all html code here";
then you have to take the variables from the form(post or get) and put them into the html code( this is called embedding)
suppose your html code is
$body = "Name: <b> formname </b>";
you want the name from the form to be shown here as bold. So change the $body to:
$body = "Name: <b> " . $_POST['formname'] . "</b>";
embed all the formvariables in the same manner.
Hope this helps
Bye