B
Brandon
Guest
I need a php script that when run emails a .txt file to me with a subject line of my choosing and than clears the .txt file of any text.
<?php
function readClearEmailFile($email, $filename) {
if (is_readable($filename)) {
$content = file_get_contents($filename);
mail($email, "File Contents", $content) or die("Error sending email.");
$handle = fopen($filename, "w+");
fclose($handle);
} else {
return $filename .' is not readable.';
}
return "File cleared, email sent successfully.";
}
?>