diff options
author | Dmitriy Zaporozhets <dzaporozhets@gitlab.com> | 2014-12-05 10:19:10 +0000 |
---|---|---|
committer | Dmitriy Zaporozhets <dzaporozhets@gitlab.com> | 2014-12-05 10:19:10 +0000 |
commit | e6c5a8b161c89a03ca5ee6666f65cf4cfbfa4ab9 (patch) | |
tree | a038e35744c8adaa8d01eb3b623a2e8f7efcb50d /lib | |
parent | 9ce9814ee3281be0e7cfa4653480284e4fe3eb9f (diff) | |
parent | cdc62cffcb86dfd939c119cba2acaf266af39f23 (diff) | |
download | gitlab-ce-e6c5a8b161c89a03ca5ee6666f65cf4cfbfa4ab9.tar.gz |
Merge branch 'rake_task_for_google_email_schema_verfication' into 'master'
Rake task for google email schema verfication
#1607
See merge request !1300
Diffstat (limited to 'lib')
-rw-r--r-- | lib/tasks/gitlab/mail_google_schema_whitelisting.rake | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/lib/tasks/gitlab/mail_google_schema_whitelisting.rake b/lib/tasks/gitlab/mail_google_schema_whitelisting.rake new file mode 100644 index 00000000000..f40bba24da8 --- /dev/null +++ b/lib/tasks/gitlab/mail_google_schema_whitelisting.rake @@ -0,0 +1,73 @@ +require "#{Rails.root}/app/helpers/emails_helper" +require 'action_view/helpers' +extend ActionView::Helpers + +include ActionView::Context +include EmailsHelper + +namespace :gitlab do + desc "Email google whitelisting email with example email for actions in inbox" + task mail_google_schema_whitelisting: :environment do + subject = "Rails | Implemented feature" + url = "#{Gitlab.config.gitlab.url}/base/rails-project/issues/#{rand(1..100)}#note_#{rand(10..1000)}" + schema = email_action(url) + body = email_template(schema, url) + mail = Notify.test_email("schema.whitelisting+sample@gmail.com", subject, body.html_safe) + if send_now + mail.deliver + else + puts "WOULD SEND:" + end + puts mail + end + + def email_template(schema, url) + "<html lang='en'> + <head> + <meta content='text/html; charset=utf-8' http-equiv='Content-Type'> + <title> + GitLab + </title> + </meta> + </head> + <style> + img { + max-width: 100%; + height: auto; + } + p.details { + font-style:italic; + color:#777 + } + .footer p { + font-size:small; + color:#777 + } + </style> + <body> + <div class='content'> + <div> + <p>I like it :+1: </p> + </div> + </div> + + <div class='footer' style='margin-top: 10px;'> + <p> + <br> + You're receiving this notification because you are a member of the Base / Rails Project project team. + <a href=\"#{url}\">View it on GitLab</a> + #{schema} + </p> + </div> + </body> + </html>" + end + + def send_now + if ENV['SEND'] == "true" + true + else + false + end + end +end |