diff options
author | George Thomas <iamgeorgethomas@gmail.com> | 2018-07-12 14:30:36 +0530 |
---|---|---|
committer | George Thomas <iamgeorgethomas@gmail.com> | 2018-07-19 12:37:59 +0530 |
commit | 32401535b9b043e258e925474dbd54adbf5a5056 (patch) | |
tree | a9705b5c7c7277d25c364573371de712af2eb27f /app/workers/emails_on_push_worker.rb | |
parent | 7f0431dd8550ac9d229d1383c03386c1634d015f (diff) | |
download | gitlab-ce-32401535b9b043e258e925474dbd54adbf5a5056.tar.gz |
Improve email address parsing
If you enter the following RFC 2822 compliant address:
`John Doe <john@doe.com>`
Gitlab will attempt to send three emails:
1) John
2) Doe
3) john@doe.com
With this change given the following:
`John Doe <johndoe@example.com>`
`Jane Doe <janedoe@example.com>`
Gitlab will send emails to `johndoe@example.com` and `janedoe@example.com`
Diffstat (limited to 'app/workers/emails_on_push_worker.rb')
-rw-r--r-- | app/workers/emails_on_push_worker.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/app/workers/emails_on_push_worker.rb b/app/workers/emails_on_push_worker.rb index 8d0cfc73ccd..17ad1d5ab88 100644 --- a/app/workers/emails_on_push_worker.rb +++ b/app/workers/emails_on_push_worker.rb @@ -51,7 +51,7 @@ class EmailsOnPushWorker end end - recipients.split.each do |recipient| + valid_recipients(recipients).each do |recipient| begin send_email( recipient, @@ -89,4 +89,10 @@ class EmailsOnPushWorker email.header[:skip_premailer] = true if skip_premailer email.deliver_now end + + def valid_recipients(recipients) + recipients.split.select do |recipient| + recipient.include?('@') + end + end end |