Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Hook right before sending mails #48

Open
skyslasher opened this issue Nov 20, 2019 · 4 comments
Open

Hook right before sending mails #48

skyslasher opened this issue Nov 20, 2019 · 4 comments

Comments

@skyslasher
Copy link

I implemented the functionality of embedding images into emails, instead of having them linked to external servers. Of course this blows up email size, but displays images right away in today's email programs and navigates around several problems with password protected sites.

To achieve this, in addition to hook into the SendBatchEvent event, I had to override \Civi\FlexMailer\Listener\DefaultSender::onSend for just one single line of injection, because the available hooks did not give me access to the full MIME message. This is needed because the whole MIME message structure is changed at this step.

I read and understood the thoughts about what interface to the message contents is used in the hooks, but for the final stage just before sending I think giving the whole MIME content and/or the powerful message object would be better. This could also implement a S/MIME or similar encryption plugin.

@skyslasher
Copy link
Author

Another approach could be to call a protected method at that point. This can be overriden in a derived object if needed.

@nganivet
Copy link

I second this request, seems useful and it is a good use case.

@mlutfy
Copy link
Member

mlutfy commented Jun 16, 2020

Hi @skyslasher, wp-civi-mosaico seems very interesting!

There may be an obvious answer, but I have to ask: how would it compare with this hook: https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_alterMailParams/ ?

@skyslasher
Copy link
Author

Hi @mlutfy,

how would it compare with this hook: https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_alterMailParams/ ?

The complete MIME-message is not available with this hook, it is constructed at a later stage in the sending process.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants