I'm making a script that checks the filesizes of all the files in a directory and will (hopefully) generate a report to be sent in email to me. I've gotten the script to have the exact desired output I want to see in an array. My problem is I don't know how to dump the contents of the array into the body of the mail() command. Here's the code. The commented out mail command should show basically what I want. (And yes, I know the code I have in there was wishful thinking. sigh) Any help will be greatly appreciated.
<?
exec("/bin/ls -1 /var/mail/",$rawdata);
$count = count($rawdata);
for ($i=0;$i<$count;$i++) {
$filesize = filesize("/var/mail/$rawdata[$i]");
if ($filesize >= 20000000) {
$num = count($data);
if ($num == "0") {
$data = array($rawdata[$i]);
}
else {
array_push($data, $rawdata[$i]);
}
}
}
$count = count($data);
for ($i=0;$i<$count;$i++) {
exec("/bin/ls -al /var/mail/$data[$i]",$newdata);
foreach ($newdata as $tempdata) {
$num = count($info);
if ($num == "0") {
$info = array($tempdata);
}
else {
array_push($info, $tempdata);
}
}
$newdata = "";
}
$count = count($info);
for ($i=0;$i<$count;$i++) {
print $info[$i]."\n";
// mail("email@address.com", "Users over 20 megs of email", "(for ($i=0;$i<$count;$i++) { print $info[$i]."\n"; })");
}
?>