05-29-2009, 02:06 PM
|
#4 (permalink)
|
|
The Gregarious
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
|
Quote:
Originally Posted by code_junkie
Its just the basic mailto function.
Code:
$to = "email@address.com";
$from = "email@address.com";
$subject = "Message from site";
$message = "";
$headers = "From: $from\r\n";
$headers .= "Content-type: text/html\r\n";
ini_set('sendmail_from', $from);
mail($to, $subject, $message, $headers);
|
Ok, well based on that, of course it's going to run on every refresh because there's nothing stopping it from running.
If you include an IF conditional that will check for a specific status, it will only run once..
I like to base it off a hidden POST variable say, "submit_form" and set that value to true. Then on the receiving page, make sure that it is set to true, then run your mail function.
After your mail function, unset that variable, that way it won't be true anymore and then if they hit refresh, it won't send the email.
|
|
|
|