Jeff VIP
Total posts: 745
14 Sep 2015 05:35

Hi,

I don't want email notifications enabled due to possible server load issues on the long term. But I do want emails to be sent when the following occurs:

  • After new record submission (Admin + Submitter)
  • After new record approval (Submitter)
  • After record deletion (Submitter)

Any ideas how this can be accomplished without enabling Cobalt's email notifications system?

Best regards, Jeff

Last Modified: 14 Dec 2015


Sergey
Total posts: 13,748
15 Sep 2015 05:37

You can create Cobalt plugin with onActivity($actor, $target, $options, $record) event. $options['type'] will contain type of event. And you can send email from there.


Jeff VIP
Total posts: 745
10 Dec 2015 00:59

Sergey You can create Cobalt plugin with onActivity($actor, $target, $options, $record) event. $options['type'] will contain type of event. And you can send email from there.

I was afraid you were going to say that ;-)

Alright then, how about defaulting the Email alerts schedule to Do not send e-mails?

In that way I'll just hide the Notifications settings button for everyone but the Super Admin.


Sergey
Total posts: 13,748
10 Dec 2015 11:14

Jeff Alright then, how about defaulting the Email alerts schedule to Do not send e-mails?

We canot change deafult setting for that parameter. But that does not change anything. If you use plugin it will work on your logic disregarding that parameter.


Jeff VIP
Total posts: 745
11 Dec 2015 23:54

Alright, I have created and installed a test plugin. It doesn't send any email, though :-(

<?php
defined('_JEXEC') or die('Restricted access');

require_once JPATH_ROOT . '/components/com_cobalt/api.php';

class plgMinttest extends JPlugin
{
    public function onActivity($actor, $target, $options, $record)
    {
        if($options['type'] == CEventsHelper::_RECORD_EDITED)
            {
                $to      = 'info_at_test.com';
                $subject = '$record edited';
                $message = '$record has been edited by $actor';
                $headers = 'From: info_at_test.com' . "\r\n" .
                    'Reply-To: info_at_test.com' . "\r\n" .
                    'X-Mailer: PHP/' . phpversion();

                mail($to, $subject, $message, $headers);
            }
    }

}

Sergey
Total posts: 13,748
14 Dec 2015 05:42

You have to consider that is user do not get notigication he will not get to this even either. For example you will not get event if you edit your own record.

Powered by Cobalt