Good day!
I would like to read several data records from a DB and send them formatted via email. I can display the data via loop, but I can't send it by email.
Ok... I solved it... I read the array with a PHP script and then pass the formatted table to the mail action.
Can you share your php script?
Thank you
function my_table($array){
$html = '<table>';
$html .= '<tr>';
foreach($array[0] as $k1=>$v1){
$html .= '<th>' . htmlspecialchars($k1) . '</th>';
}
$html .= '</tr>';
foreach( $array as $k1=>$v1){
$html .= '<tr>';
foreach($v1 as $k2=>$v2){
$html .= '<td>' . htmlspecialchars($v2) . '</td>';
}
$html .= '</tr>';
}
$html .= '</table>';
return $html;
}
$array = $this->get("data");
return my_table($array);