Hi guys, I've got this code within a script. It emails the users when I publish their story on my website (and it also emails the person whom the story is about) However, if I edit the story and save they get repeat emails... How can I get this to only send one email (the very first time the story is approved and saved)? if ($table->save($_POST)){ $story_id = $_POST['id']; if ($_POST['published'] == 1) { $query = "SELECT u.name, u.email" . "\n FROM #__users AS u" . "\n LEFT JOIN #__vst_stories AS s ON u.id = s.user_id" . "\n WHERE s.id = $story_id"; $database->setQuery($query); $database->loadObject(&$row); $query = "SELECT *" . "\n FROM #__vst_mail_templates" . "\n WHERE id = 14"; $database->setQuery($query); $database->loadObject(&$obj); $body = str_replace('[NAME]', $row->name, $obj->body); mosMail($mosConfig_mailfrom, $mosConfig_fromname, $row->email, $obj->subject, $body, true); } Code (markup): Thanks for your help, RJP1
Remark mosMail.... to //mosMail.... but i don't know if this affects all options, please give more code!