Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 671831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:25:01+00:00 2026-05-14T00:25:01+00:00

I am trying to send an email through the result sets generated in MySQL

  • 0

I am trying to send an email through the result sets generated in MySQL in PHP

This is the code.

<?php
$txtMsg = '<table><th>Name</th>';
$txtMsg = '';
  mysql_connect("localhost", "root", "pop") or die(mysql_error());
      mysql_select_db("jpd") or die(mysql_error());
      $oustanding = mysql_query("select Name from results") or die(mysql_error());  
      $num=mysql_num_rows($oustanding);

      while($row1 = mysql_fetch_array( $oustanding )) {
          ?>
        <tr>
            <td><h3><?php echo $row1['Name']; ?></h3></td>

        </tr>
<?php
$txtMsg .= "<tr><td>".$row1['Name']."</td></tr>";
}     


ini_set ( "SMTP", "xy.domain.com" ); 
$mail_to= 'someone@domain.com';
$mail_from='someone@domain.com';
$mail_sub='OutStanding Results';
$mail_mesg=$txtMsg;

//Check for success/failure of delivery 
if(mail($mail_to,$mail_sub,$mail_mesg,"From: $mail_from"))
echo "<br><br>Email Successfully Sent!";
else
echo "<br><br>Error Sending Email!";
}

?>

The problem is , I want the results to be displayed in table format. But instead of processing the html tags, they are getting printed as well.

How to get the email with table format?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T00:25:01+00:00Added an answer on May 14, 2026 at 12:25 am

    You need to specify your e-mail message as HTML. Try this:

    $headerFields = array(
        "From: $mail_from",
        "MIME-Version: 1.0",
        "Content-Type: text/html;charset=iso-8859-1"
    );
    mail($mail_to, $mail_sub, $mail_mesg, implode("\r\n", $headerFields))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I´m trying to send an email through gmail using this code: MailMessage msg =
I'm trying to send an email via some C# ASP.NET code. This is being
I am trying to send a simple email through the following code: protected void
Hi there I'm trying to send an HTML email through a PHP webform. The
I am trying to send an email through following code CODE Dim MyMailMessage As
I am trying to send an email through php. I have tried sending to
I'm trying to send an email through the Facebook API. I've added the application
I am trying to send email using smtp authentication through google but I am
Possible Duplicate: Sending email in .NET through Gmail I am trying to send a
I am trying to send an attachment through AWS Simple Email Service, and i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.