I have a PHP webpage that displays a list of email subject lines and the body from the past month. There are only about 25 emails for it to load and they are reasonably short with no attachment. To achieve this I am using the below code:
$result = imap_fetch_overview($inbox,"1:{$MC->Nmsgs}",0);
foreach ($result as $overview) {
$timestamp=$overview->udate;
if (date('m', $timestamp) === date('m')) {
$timestamp = $overview->udate;
$realdate = gmdate("Y-m-d", $timestamp);
$messageBody = imap_fetchbody($inbox,$overview->uid,1);
echo "<tr><td><button style='background: none; border: none; padding: 0;' onclick=\"showContent('".$overview->uid."')\" class=\"\">" . " {$overview->subject} " . "</button></td><td>" . "{$realdate} " . "</td></tr>";
echo "<tr><td id='".$overview->uid."' class='w3-container w3-hide '><div><p>$messageBody</p></div></td></tr>";
}
}
This does eventually load but it is taking about 30 seconds, my question is is there anyway for me to reduce these loading times?