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 6227745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:16:25+00:00 2026-05-24T09:16:25+00:00

I have created a file called ‘userhistoryreport.php’. It will be setup to run once

  • 0

I have created a file called ‘userhistoryreport.php’. It will be setup to run once a day. The purpose of the file is to gather contact information and history for users who have interacted with the site for that particular day. The script works, but I am unsure of how to get the results to send to email. The email should be formatted just like the page in the broswer – where each user is listed with their history. Any help is appreciated.

echo '<div style="padding: 0 20px;">';
echo '<span style="display: block; font-size: 22px; font-weight: bold; margin: 25px 0 -15px 0;"> User Activity on' . $website . 'for' . $date . '</span>';


//query the database for today's history
$result = mysql_query("SELECT * FROM user_history WHERE date = '$date' ORDER by name, time, title") 
or die(mysql_error());
$old_user = '';   

    while($row = mysql_fetch_array( $result )) {
        $new_user = $row['uid'];
        if ($new_user != $old_user) {
            echo '<br /><br /><hr />' . '<span style="font-size: 18px; font-weight: bold;">' . $row['name'] . '</span>' . '<br />' . $row['company'] . '<br />' . $row['email'] . '<br />' . $row['phone'] . '<br /><br />'; 
            $old_user = $new_user;
        }
        echo '<ul><li>' . $row['time'] .
        '<ul><li>' . $row['title'] . ' (<a href="' . $row['url'] . '">' . $row['url'] . '</a> )' . '</li></ul>' . '<br /><br />' .
        '</li></ul>';
    }  
echo '</div>';

echo 
'<div style="position: fixed; bottom: 0; height: 40px; width: 100%; margin: 20px 0 0 0; background: #000; color: #FFF; line-height: 40px;">' .
'Report generated ' . $date . ' ' . $time .
'</div>';
  • 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-24T09:16:26+00:00Added an answer on May 24, 2026 at 9:16 am

    Straight from the mail() function in the php manual, try this;

    Put all of your html into a string instead of echoing it immediately, by replacing all your echoes with something like this;

    $message .= '<br /><br /><hr />' . '<span style="font-size: 18px; font-weight: bold;">' . $row['name'] . '</span>' . '<br />' . $row['company'] . '<br />' . $row['email'] . '<br />' . $row['phone'] . '<br /><br />';           
    $message .= '<ul><li>' . $row['time'] .
        '<ul><li>' . $row['title'] . ' (<a href="' . $row['url'] . '">' . $row['url'].     '</a> )' . '</li></ul>' . '<br /><br />' .
        '</li></ul>';
    

    To display the report, use

    echo $message;
    

    To mail the report, put this bit after the final closing tag to send the report with html.

     // To send HTML mail, the Content-type header must be set
    $headers  = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    
    // Additional headers
    $headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "\r\n";
    $headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n";
    $headers .= 'Cc: birthdayarchive@example.com' . "\r\n";
    $headers .= 'Bcc: birthdaycheck@example.com' . "\r\n";
    
    
    // Mail it
    mail('your@emailadress.com', 'Report generated ' . $date . ' ' . $time, $message, $headers);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a filelist.txt file and I created a file called clear.php to clear
I have created a bat file which calls selenium server called run-selenium-server.bat which has:
How to manually create Friendly URLs? (PHP) So I have created simple php file
I have created a user called wine to run Wine under for two reasons:
I have created a file called myblock.phtml in frontend\default\default\layout\mytemplate .It simply displays a check
I have a custom taxonomy called dcategory so I have created a template file
I have created a config file within my project, and called it MyConfig.config. It
I have an issue, so i created a mxml container file called Container1.mxml that
I have created a file reader class called ECGFilereader which should open a .txt
I have created a project called zz and it has a single file called

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.