argoproj / notifications-engine

Affordable notifications for Kubernetes
Apache License 2.0
264 stars 134 forks source link

Add support for multiple to email addresses in single recepient #226

Closed gokulav137 closed 8 months ago

gokulav137 commented 9 months ago

This adds support for comma separated email addresses to add capability to send emails with multiple email addresses as recipients.

Current implementation only allows an email to be sent to one email address at a time. This enhancement will add support to send a email with multiple to addresses.

Eg:

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

Tested locally

Resolves: #222

codecov[bot] commented 9 months ago

Codecov Report

All modified lines are covered by tests :white_check_mark:

Comparison is base (8ba938e) 54.05% compared to head (16e8ab2) 54.76%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #226 +/- ## ========================================== + Coverage 54.05% 54.76% +0.71% ========================================== Files 35 35 Lines 3306 3316 +10 ========================================== + Hits 1787 1816 +29 + Misses 1252 1232 -20 - Partials 267 268 +1 ``` | [Files](https://app.codecov.io/gh/argoproj/notifications-engine/pull/226?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=argoproj) | Coverage Δ | | |---|---|---| | [pkg/services/email.go](https://app.codecov.io/gh/argoproj/notifications-engine/pull/226?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=argoproj#diff-cGtnL3NlcnZpY2VzL2VtYWlsLmdv) | `73.77% <100.00%> (+42.39%)` | :arrow_up: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

gokulav137 commented 9 months ago

Hi @pasha-codefresh, Could you please review this PR

pasha-codefresh commented 8 months ago

LGTM, what do you think about trim whitespaces ? i think a lot of users will user user1@gmail.com, user2@gmail.com and so on

@gokulav137

gokulav137 commented 8 months ago

LGTM, what do you think about trim whitespaces ? i think a lot of users will user user1@gmail.com, user2@gmail.com and so on

@gokulav137

That seems like a good addition. Will add that logic.

gokulav137 commented 8 months ago

Hi @pasha-codefresh, added the trim. Hope this looks good.

pasha-codefresh commented 8 months ago

Great job, thank you