How to get email parameters using the "transport", "system:email" plugin hook?

Hi, After having a lot of failed attempts in configuring elgg smtp for amazon ses, i thought of connecting to SES via smtp.

For elgg 2.3 branch, I am able to extract the message details like from, to, body, subect etc using the 'email', 'system' hook.

But in 3.X branch, how to retrieve this information? I tried listening to  "transport", "system:email" hook, but its not working. Any idea on how to use this hook properly to retrieve the above informations?

I want to push mails through SES via phpmailer library.

  • Following is my code. I am able to retrieve subject and body, but I am not getting the from and to address.

    function phpmailer_hook($hook, $type, $return, $params) {
        $email = $params['email'];
        $from = $email->getFrom();
        $to = $email->getTo();
        $subject = $email->getSubject();
        $body = $email->getBody();
        // .....
  • The email parameter should be an instance of \Elgg\Email.

    Learn docs.


Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking