Would it be easy to send out email alerts to my users when one of them adds a new page to the system? If so can you point me in the right direction.
Many many thanks
Simon
you need a plugin that send a email when create a new page event...
+1 I would very much like to see such a plugin come to life... should add this to the Wishlist board !
.: COO - Commerce Guys - Community Driven Innovation :.
MODx est l'outil id
here are the code, simply retouch to sweet the email to your needs and select ondocformsave
here are too a call
$bloqued_emails=array(); for put the emails to not send notification, put a coma delimited list separated by ,
hi
function sendEmail($to) {
global $modx;
$subject = "email notyfy new page created";
$headers = "MIME-Version: 1.0\n".
"Content-type: text/html; charset=iso-8859-1\n".
"From: ".$modx->config[’site_name’]."".
"Reply-To: no-reply@{$_SERVER[’HTTP_HOST’]}\n".
"X-Mailer: PHP/".phpversion();
$user = $to;
$body = "New Page created
parent ::".$_POST[’parent’]."
pagetiltle ::".$_POST[’pagetitle’];
$mail = mail($to, $subject, $body, $headers);
if(!$mail) { return "error sending"; }
return $mail;
}
if ($_POST[’id’]==""){
$bloqued_emails=array();
$table = $modx->getFullTableName("user_attributes");
$parent_id=$modx->db->select("id,fullname,email", $table, "", "", "");
while($row=mysql_fetch_array($parent_id)){
if (in_array($row[’email’],$bloqued_emails)){}else{
$email = sendEmail($row[’email’]);}
}
}else{}
change please the title of the email to a [plugin] hi
Thanks for the help, but where in modx do I put all this? Do I create a new snippet?
create a new plugin and check ondocformsave
hi
cheers xyzvisual
I`ll give this a try when I get home from work tonight.
Many many thanks.
Simon
change please the title of the email to a [plugin] hi
I`m not sure what you mean by this can you paste the change in here,
When I add the module what name should I call it? can this be anything?
Do I need to do anything else when Installing it? tick any other boxes?
I just installed the module and got an error?
-
☆ A M B ☆
- 24,524 Posts
It’s a plugin. You can name it anything you like.