Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Thomas <iamgeorgethomas@gmail.com>2018-07-12 12:00:36 +0300
committerGeorge Thomas <iamgeorgethomas@gmail.com>2018-07-19 10:07:59 +0300
commit32401535b9b043e258e925474dbd54adbf5a5056 (patch)
treea9705b5c7c7277d25c364573371de712af2eb27f /app/workers
parent7f0431dd8550ac9d229d1383c03386c1634d015f (diff)
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')
-rw-r--r--app/workers/emails_on_push_worker.rb8
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