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

Refactor email plugin config syntax #1338

Merged
merged 2 commits into from
Dec 11, 2024

Conversation

reidsunderland
Copy link
Member

This is a proposal to change the email plugin configuration syntax to take advantage of the additional accept statement "arguments" added in #1289.

Previously, the email plugin had to do it's own regex matching/filtering to determine the recipients for a particular file. Now, it just gets the recipients from the mask, removing this redundancy.

I made a copy, called email_old before making modifications. I thought it might be useful if someone didn't want to update their config file.

Old syntax:

callback send.email_old

file_email_to AACN27 [email protected], [email protected]
file_email_relay email.relay.server.ca
file_email_from [email protected]

accept .*AACN27.*

New syntax:

callback send.email

sendTo smtp://email.relay.server.ca
# sendTo email.relay.server.ca  also works

# optional
email_from [email protected]

email_subject_prepend  Sent by Sarracenia: 

accept .*AACN27.*  [email protected], [email protected]

I also added a new option, email_subject_prepend, because we have some other email plugins internally that add extra text in the subject. I wanted this to be able to replace all of our email plugins, and eliminate hard-coded configuration in the plugin code.

@reidsunderland
Copy link
Member Author

Oh, and it works in a sender or subscriber/sarra.

Copy link
Contributor

@petersilva petersilva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great improvement!

We tend to accumulate cruft (v1, 2, 3...) when we keep old stuff around... we have git for that. Would prefer to delete email_old, and have everyone change over... but could be done as second step for transition purposes... anyways not worth rejecting for that.

Copy link

Test Results

238 tests   235 ✅  1m 33s ⏱️
  1 suites    1 💤
  1 files      2 ❌

For more details on these failures, see this check.

Results for commit 18d9b9d.

@reidsunderland
Copy link
Member Author

I looked at our configs and nothing is currently using the current/old email plugin, so I removed email_old. There's one config on dev and stage that we will update once we release the new sr3 version.

@reidsunderland reidsunderland merged commit f53146e into development Dec 11, 2024
0 of 4 checks passed
@reidsunderland reidsunderland deleted the issue1289_email_example branch December 18, 2024 20:51
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

Successfully merging this pull request may close these issues.

2 participants