PHP and SQL

I have the following code sending an email after someone joins. It works perfectly, but I would like the email sent as an HTML file so the <p></p> tags don't show up.
$config_sql = "SELECT * FROM Config WHERE Name='JoinSubmitEmailAddress'";
            $config_sql_result = mysql_query($config_sql);        
            if (mysql_num_rows($config_sql_result))
            {
                  $config_row = mysql_fetch_assoc($config_sql_result);
                  $mail_To = $SubmitEmail;               
                  $mail_From = "From: " . $config_row['Value'];
                  $mail_Subject = "Thank You For Joining";
                
                  $config_sql = "SELECT * FROM Content WHERE Page='JoinWelcomeEmail'";

                  $config_sql_result = mysql_query($config_sql);

                  if(!$config_sql_result) die(mysql_error());

                  $config_row = mysql_fetch_assoc($config_sql_result);

                  if(!$config_row) die('Configuration for JoinEmailSubmitted not found');                   

                  $message = 'Config: '.$config_row['PageContent'];

                 
		$body .= "First Name: " . stripslashes($FirstName); 

		$body .= "\nLast Name: " . stripslashes($LastName);
		
		$body .= "\nWedding Date: " . stripslashes($weddingdate);
		
		$body .= "\nPhone: " . stripslashes($phone_01);
		
		$body .= "\nUsername: " . stripslashes($SubmitEmail); 

		$body .= "\nPassword: " . stripslashes($Password);
		
		$body .= "\nWedding Date: " . stripslashes($weddingdate);

                 

                  $message = $config_row['PageContent']."\n\n";
$message .= "$body\n\n"; 


                  mail($mail_To, $mail_Subject, $message . "\n\n", $mail_From);

            }

            else

            {

                  echo "Error retrieving admin e-mail address from database\n";

                  exit;

            }

Open in new window

katleesAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Lukasz ChmielewskiCommented:
http://pl2.php.net/manual/en/function.mail.php
See example #4 - you have to add proper headers.
0
Dave BaldwinFixer of ProblemsCommented:
Take a look at http://php.net/manual/en/function.mail.php in the middle of the page.  In some circumstances, you might to generate a complete multipart mail format.  The PHPMailer() is more capable but more complicated.  http://www.askapache.com/php/phpfreaks-eric-rosebrocks-phpmailer-tutorial.html
0
scifo_dkCommented:
You need to add this:

$headers = "Content-type: text/html; charset=iso-8859-1\r\n";

$headers .= "\n ".$mail_From

And then use the $headers in the mail()-function, so it becomes:
mail($mail_To, $mail_Subject, $message . "\n\n", $mail_From);
0
Rowby Goren Makes an Impact on Screen and Online

Learn about longtime user Rowby Goren and his great contributions to the site. We explore his method for posing questions that are likely to yield a solution, and take a look at how his career transformed from a Hollywood writer to a website entrepreneur.

katleesAuthor Commented:
Roads_Roads - I tried yours and no message was sent at all
scifo_dk - I tried yours and I still get the paragraph tags in the message
0
scifo_dkCommented:
Which e-mail client are you using?
0
Chris StanyonWebDevCommented:
@katlees:

Try creating your email message as a complete HTML page, including the <html> and <body> tags.

Change lines 39-40 to the following.

You'll also need to set the content type as scifo_dk has already suggested, and make sure your headers are set correctly.
$message = "<html><body>";
$message .= $config_row['PageContent'];
$message .= $body;
$message .= "</body></html>";

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.