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

Email Notifications don't support multiple to addresses #222

Closed
gokulav137 opened this issue Sep 24, 2023 · 0 comments · Fixed by #226
Closed

Email Notifications don't support multiple to addresses #222

gokulav137 opened this issue Sep 24, 2023 · 0 comments · Fixed by #226

Comments

@gokulav137
Copy link
Contributor

Currently each recipients email address would be send a separate email address.

So an email will be sent out for each recipient [email protected] and [email protected] for the following:

apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: another
  annotations:
    notifications.argoproj.io/subscriptions: |
      - trigger: [on-cert-ready]
        destinations:
          - service: email
            recipients: [[email protected], [email protected]]
spec:
  secretName: something
  issuerRef:
    name: letsencrypt-staging
  emailAddresses:
    - [email protected]

Proposition

I would like to propose adding a feature to support comma separated email addresses so that we can we can do the below:

apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: another
  annotations:
    notifications.argoproj.io/subscriptions: |
      - trigger: [on-cert-ready]
        destinations:
          - service: email
            recipients: ["[email protected],[email protected]", [email protected]]
spec:
  secretName: something
  issuerRef:
    name: letsencrypt-staging
  emailAddresses:
    - [email protected]

Here one email would be sent with only [email protected] as recipient and another with both [email protected] and [email protected].

This can be done by introducing the following change in https://github.com/argoproj/notifications-engine/blob/master/pkg/services/email.go#L77-L84:

to := String.Split(dest.Recipient, ",")
email := smtp.New(smtp.Options{
........
........
}).WithSubject(subject).WithBody(body).To(to[0], to[1:]...)

This shouldn't break any existing functionality. I have tested this out locally.

I can raise a PR if this seems useful.

Originally posted by @gokulav137 in argoproj/argo-events#2793 (comment)

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 a pull request may close this issue.

1 participant