I have a little routine which looks something like this
<?php
class OPS_debug
{
/**
* @return string
* @param mixed $in
* @desc returns a dumpvar as a string
*/
function dumpvar($in)
{
$type = gettype($in);
if ($type == 'array')
{
ksort($in);
reset($in);
}
ob_start();
var_dump($in);
$in = ob_get_contents();
ob_end_clean();
if($type == 'array')
{
// Split into an array
$in = explode("\n", $in);
// Do the br'in
$x = 0;
foreach($in as $value)
{
if($x%2 == 0) $in[$x] .= "\n";
$x++;
}
// Put it back together
$ins = NULL;
foreach($in as $value)
{
$ins .= $value;
}
return $ins ;
}
else
{
return $in ;
}
}//function dumpvar($in)
function mailme($subject, $in)
{
$body = OPS_debug::dumpvar($in);
mail('webmaster@mysite.com', $subject, $body);
}//mailme
}//OPS_debug
?>
from anywhere in my code I can call
OPS_debug::mailme('subject line', $var);
and I'll get emailed a vardump of the variable.
In your case you might have a second option which formats particular data etc.
I've doctored this but I normally use phpMailer as well and send as html so I can have some control over the styling. It would also allow me to have tables, row formatting etc.
Hopefully this will give you some ideas...
Sarah