mailjet mailers
This commit is contained in:
parent
5a9c4a341a
commit
9f7f29f327
@ -27,6 +27,7 @@ Style/StringLiterals:
|
||||
Metrics/AbcSize:
|
||||
Exclude:
|
||||
- db/migrate/**/*
|
||||
- app/controllers/oauths_controller.rb
|
||||
|
||||
Metrics/LineLength:
|
||||
Max: 95
|
||||
@ -39,3 +40,4 @@ Metrics/LineLength:
|
||||
Metrics/MethodLength:
|
||||
Exclude:
|
||||
- db/migrate/*
|
||||
- app/controllers/oauths_controller.rb
|
||||
|
1
Gemfile
1
Gemfile
@ -12,6 +12,7 @@ gem 'autoprefixer-rails', '~> 0.8'
|
||||
gem 'haml-rails', "~> 0.9"
|
||||
gem 'jquery-rails'
|
||||
gem 'json', '~> 1.8.3'
|
||||
gem 'mailjet', '~> 1.1.0'
|
||||
gem 'mysql2', '~> 0.3.20'
|
||||
gem 'responders', '~> 2.1.0'
|
||||
gem 'sass-rails', '~> 5.0'
|
||||
|
17
Gemfile.lock
17
Gemfile.lock
@ -63,6 +63,8 @@ GEM
|
||||
columnize (0.9.0)
|
||||
daemons (1.2.3)
|
||||
debug_inspector (0.0.2)
|
||||
domain_name (0.5.25)
|
||||
unf (>= 0.0.5, < 1.0.0)
|
||||
em-websocket (0.5.1)
|
||||
eventmachine (>= 0.12.9)
|
||||
http_parser.rb (~> 0.6.0)
|
||||
@ -120,6 +122,8 @@ GEM
|
||||
haml (~> 4.0.0)
|
||||
nokogiri (~> 1.6.0)
|
||||
ruby_parser (~> 3.5)
|
||||
http-cookie (1.0.2)
|
||||
domain_name (~> 0.5)
|
||||
http_parser.rb (0.6.0)
|
||||
i18n (0.7.0)
|
||||
jquery-rails (4.0.5)
|
||||
@ -136,6 +140,10 @@ GEM
|
||||
lumberjack (1.0.9)
|
||||
mail (2.6.3)
|
||||
mime-types (>= 1.16, < 3)
|
||||
mailjet (1.1.0)
|
||||
activesupport (>= 3.1.0)
|
||||
rack (>= 1.4.0)
|
||||
rest-client
|
||||
method_source (0.8.2)
|
||||
mime-types (2.6.1)
|
||||
mini_portile (0.6.2)
|
||||
@ -150,6 +158,7 @@ GEM
|
||||
multipart-post (2.0.0)
|
||||
mysql2 (0.3.20)
|
||||
nenv (0.2.0)
|
||||
netrc (0.10.3)
|
||||
nokogiri (1.6.6.2)
|
||||
mini_portile (~> 0.6.0)
|
||||
notiffany (0.0.7)
|
||||
@ -210,6 +219,10 @@ GEM
|
||||
ffi (>= 0.5.0)
|
||||
responders (2.1.0)
|
||||
railties (>= 4.2.0, < 5)
|
||||
rest-client (1.8.0)
|
||||
http-cookie (>= 1.0.2, < 2.0)
|
||||
mime-types (>= 1.16, < 3.0)
|
||||
netrc (~> 0.7)
|
||||
rubocop (0.33.0)
|
||||
astrolabe (~> 1.3)
|
||||
parser (>= 2.2.2.5, < 3.0)
|
||||
@ -262,6 +275,9 @@ GEM
|
||||
uglifier (2.7.2)
|
||||
execjs (>= 0.3.0)
|
||||
json (>= 1.8.0)
|
||||
unf (0.1.4)
|
||||
unf_ext
|
||||
unf_ext (0.0.7.1)
|
||||
web-console (2.2.1)
|
||||
activemodel (>= 4.0)
|
||||
binding_of_caller (>= 0.7.2)
|
||||
@ -288,6 +304,7 @@ DEPENDENCIES
|
||||
haml_lint
|
||||
jquery-rails
|
||||
json (~> 1.8.3)
|
||||
mailjet (~> 1.1.0)
|
||||
minitest-reporters
|
||||
mysql2 (~> 0.3.20)
|
||||
pry-byebug
|
||||
|
@ -14,8 +14,8 @@ class OauthsController < ApplicationController
|
||||
else
|
||||
begin
|
||||
@user = create_from(provider)
|
||||
# NOTE: this is the place to add '@user.activate!'
|
||||
# if you are using user_activation submodule
|
||||
# NOTE: this is the place to add '@user.activate!' if you
|
||||
# are using user_activation submodule
|
||||
|
||||
reset_session # protect from session fixation attack
|
||||
auto_login(@user)
|
||||
|
6
app/mailers/account_mailer.rb
Normal file
6
app/mailers/account_mailer.rb
Normal file
@ -0,0 +1,6 @@
|
||||
class AccountMailer < ApplicationMailer
|
||||
def activation_needed
|
||||
@blarg = "This was blarg"
|
||||
mail(to: 'markamoser+test@gmail.com', subject: 'Activate me please!')
|
||||
end
|
||||
end
|
4
app/mailers/application_mailer.rb
Normal file
4
app/mailers/application_mailer.rb
Normal file
@ -0,0 +1,4 @@
|
||||
class ApplicationMailer < ActionMailer::Base
|
||||
default from: ENV['default_mail_from']
|
||||
layout 'mailer'
|
||||
end
|
4
app/views/account_mailer/activation_needed.html.haml
Normal file
4
app/views/account_mailer/activation_needed.html.haml
Normal file
@ -0,0 +1,4 @@
|
||||
!!!
|
||||
%h3 Activate me please
|
||||
|
||||
%p and then: #{@blarg}
|
3
app/views/layouts/mailer.html.haml
Normal file
3
app/views/layouts/mailer.html.haml
Normal file
@ -0,0 +1,3 @@
|
||||
%hmtl
|
||||
%body
|
||||
= yield
|
1
app/views/layouts/mailer.text.haml
Normal file
1
app/views/layouts/mailer.text.haml
Normal file
@ -0,0 +1 @@
|
||||
= yield
|
@ -21,5 +21,6 @@ module SmsPager
|
||||
|
||||
# Do not swallow errors in after_commit/after_rollback callbacks.
|
||||
config.active_record.raise_in_transactional_callbacks = true
|
||||
config.action_mailer.delivery_method = :mailjet
|
||||
end
|
||||
end
|
||||
|
5
config/initializers/mailjet.rb
Normal file
5
config/initializers/mailjet.rb
Normal file
@ -0,0 +1,5 @@
|
||||
Mailjet.configure do |config|
|
||||
config.api_key = ENV['mailjet_key']
|
||||
config.secret_key = ENV['mailjet_secret']
|
||||
config.default_from = ENV['default_mail_from']
|
||||
end
|
7
test/mailers/account_mailer_test.rb
Normal file
7
test/mailers/account_mailer_test.rb
Normal file
@ -0,0 +1,7 @@
|
||||
require 'test_helper'
|
||||
|
||||
class AccountMailerTest < ActionMailer::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
3
test/mailers/previews/account_mailer_preview.rb
Normal file
3
test/mailers/previews/account_mailer_preview.rb
Normal file
@ -0,0 +1,3 @@
|
||||
# Preview all emails at http://localhost:3000/rails/mailers/account_mailer
|
||||
class AccountMailerPreview < ActionMailer::Preview
|
||||
end
|
Loading…
Reference in New Issue
Block a user