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.
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.
You want it to email you the .txt file, then delete the .txt file, while at the same time know what the subject line should be? Basicly, an automated email form, like then one on phpBB?
No. It emails me the .txt file with a subject line I want then clears out the .txt file to a blank one
Ok. I got it now. I will try to make the PHP later tonight. Got chores now (damn). Will contact you later with the code.
Do it yourself. It's that hard. You need the help?
You code do it in, I would think, 10 lines or less.
http://php.net/fopen
http://php.net/fread
http://php.net/mail
http://php.net/fwrite
I could do it in... maybe 5-6. Whats the name of teh text file, your email address, and all that. I'll type it.
Last edited by Bryon; 08-30-2005 at 10:13 PM.
I use to know how to do php
Wow I made a few mistakes in that other post of mine. I meant "It's not that hard", and "I could do it in 10 lines or less".
Make sure to chmod the file so it can be "read" by the script.PHP Code:<?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.";
}
?>
Last edited by Bryon; 09-01-2005 at 12:35 AM.
yay NedreN is awesome
-J.P.