Integration with Amazon SES

We would like to integrate Elgg's email notifications with Amazon SES.

We would highly appreciate any guidance.

 

  • I believe SES supports SMTP so you can just hijack Elgg's mailer, which uses Zend Mailer and configure it with an SMTP adapter. We added public API for it, but not sure if it was for 2.x or 3.x. You can look how I have done it in hype Notifications, or just use the plugin and configure it with your SES SMTP.
    If you want to use the AWS SDK you can use one of the notification hooks, check the Elgg docs to decide which one.

  • Thank you Ismayil. I use their SDK for other project, and would like to use it here as well I'm new to Elgg (and amazed by this beautiful project). Even though I have a few years of php mysql experience, I'm self-trained and not sure I understand where to look for "notification hooks". I'd appreciate any direction.

    Thank you for the many useful plugins you've developed.

    Reuven 

  • The complete list of hooks is documented here: http://learn.elgg.org/en/stable/guides/hooks-list.html

    I am not sure, which Elgg version you are using, but in 2.x you would use the email,system hook, which is somewhat limiting and there are always plugins fighting over who gets to do what with it (in 3.x there is more granularity and you would use transport,sytem:email hook).

    elgg_register_plugin_hook_handler('email', 'system', function($hook, $type, $return, $params) {
    
       if ($return === true) {
          // another handler sent the email, bailing
          return; // returning null or void from a hook preserves the return value
          // identical to return $return;
       }
    
       $to = elgg_extract('to', $params);
       $from = elgg_extract('from', $params);
       // etc unpack and validate all the parameters
    
       // instantiate AWS SDK and transport the email
    
       return true; // important! tells other plugins that email was sent
    });
  • Thank you Ismayil.

    I'm using the latest 2.x. and will try to implement based on your tips.