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) " GitLab

I like it :+1:

" end def send_now if ENV['SEND'] == "true" true else false end end end