Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement send_mail built in event hook behavior #313

Closed
signebedi opened this issue Jul 6, 2024 · 2 comments
Closed

Implement send_mail built in event hook behavior #313

signebedi opened this issue Jul 6, 2024 · 2 comments

Comments

@signebedi
Copy link
Owner

This will look something like:

send_mail:
  template: form_created
  method: static
  target: [email protected]

Where the template points to one of the template names in the email config, method is an enum of ['static', 'group', and 'relationship'], and target is the value used to select the emails to send, based on the method. So, the example above will always send Bob a form_created email to [email protected] when a form is submitted. But, if we wanted to send this to all members of the default group, we could do the following:

send_mail:
  template: form_created
  method: group
  target: default

Originally posted by @signebedi in #210 (comment)

@signebedi
Copy link
Owner Author

I think the format will need to change slightly, along the lines of:

on_create:
  - type: send_mail
    template: form_created
    method: static
    target: [email protected]

This will ensure we create a list of dicts.

ALSO: static target should split and trim on commas, so we can send to multiple people with one entry.

@signebedi
Copy link
Owner Author

[bug] send mail event hook fails with multiple recipients
In Python 2, you should be able to just use comma separated list represented as a string. https://stackoverflow.com/a/12422921. However, apparently this does not work in Python 3 and we need to use send_message instead, see https://docs.python.org/3/library/email.examples.html.

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

No branches or pull requests

1 participant