mailjet mailers

This commit is contained in:
Mark Moser 2015-10-08 19:16:33 -05:00
parent 5a9c4a341a
commit 9f7f29f327
13 changed files with 56 additions and 2 deletions

View File

@ -27,6 +27,7 @@ Style/StringLiterals:
Metrics/AbcSize: Metrics/AbcSize:
Exclude: Exclude:
- db/migrate/**/* - db/migrate/**/*
- app/controllers/oauths_controller.rb
Metrics/LineLength: Metrics/LineLength:
Max: 95 Max: 95
@ -39,3 +40,4 @@ Metrics/LineLength:
Metrics/MethodLength: Metrics/MethodLength:
Exclude: Exclude:
- db/migrate/* - db/migrate/*
- app/controllers/oauths_controller.rb

View File

@ -12,6 +12,7 @@ gem 'autoprefixer-rails', '~> 0.8'
gem 'haml-rails', "~> 0.9" gem 'haml-rails', "~> 0.9"
gem 'jquery-rails' gem 'jquery-rails'
gem 'json', '~> 1.8.3' gem 'json', '~> 1.8.3'
gem 'mailjet', '~> 1.1.0'
gem 'mysql2', '~> 0.3.20' gem 'mysql2', '~> 0.3.20'
gem 'responders', '~> 2.1.0' gem 'responders', '~> 2.1.0'
gem 'sass-rails', '~> 5.0' gem 'sass-rails', '~> 5.0'

View File

@ -63,6 +63,8 @@ GEM
columnize (0.9.0) columnize (0.9.0)
daemons (1.2.3) daemons (1.2.3)
debug_inspector (0.0.2) debug_inspector (0.0.2)
domain_name (0.5.25)
unf (>= 0.0.5, < 1.0.0)
em-websocket (0.5.1) em-websocket (0.5.1)
eventmachine (>= 0.12.9) eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0) http_parser.rb (~> 0.6.0)
@ -120,6 +122,8 @@ GEM
haml (~> 4.0.0) haml (~> 4.0.0)
nokogiri (~> 1.6.0) nokogiri (~> 1.6.0)
ruby_parser (~> 3.5) ruby_parser (~> 3.5)
http-cookie (1.0.2)
domain_name (~> 0.5)
http_parser.rb (0.6.0) http_parser.rb (0.6.0)
i18n (0.7.0) i18n (0.7.0)
jquery-rails (4.0.5) jquery-rails (4.0.5)
@ -136,6 +140,10 @@ GEM
lumberjack (1.0.9) lumberjack (1.0.9)
mail (2.6.3) mail (2.6.3)
mime-types (>= 1.16, < 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) method_source (0.8.2)
mime-types (2.6.1) mime-types (2.6.1)
mini_portile (0.6.2) mini_portile (0.6.2)
@ -150,6 +158,7 @@ GEM
multipart-post (2.0.0) multipart-post (2.0.0)
mysql2 (0.3.20) mysql2 (0.3.20)
nenv (0.2.0) nenv (0.2.0)
netrc (0.10.3)
nokogiri (1.6.6.2) nokogiri (1.6.6.2)
mini_portile (~> 0.6.0) mini_portile (~> 0.6.0)
notiffany (0.0.7) notiffany (0.0.7)
@ -210,6 +219,10 @@ GEM
ffi (>= 0.5.0) ffi (>= 0.5.0)
responders (2.1.0) responders (2.1.0)
railties (>= 4.2.0, < 5) 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) rubocop (0.33.0)
astrolabe (~> 1.3) astrolabe (~> 1.3)
parser (>= 2.2.2.5, < 3.0) parser (>= 2.2.2.5, < 3.0)
@ -262,6 +275,9 @@ GEM
uglifier (2.7.2) uglifier (2.7.2)
execjs (>= 0.3.0) execjs (>= 0.3.0)
json (>= 1.8.0) json (>= 1.8.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.1)
web-console (2.2.1) web-console (2.2.1)
activemodel (>= 4.0) activemodel (>= 4.0)
binding_of_caller (>= 0.7.2) binding_of_caller (>= 0.7.2)
@ -288,6 +304,7 @@ DEPENDENCIES
haml_lint haml_lint
jquery-rails jquery-rails
json (~> 1.8.3) json (~> 1.8.3)
mailjet (~> 1.1.0)
minitest-reporters minitest-reporters
mysql2 (~> 0.3.20) mysql2 (~> 0.3.20)
pry-byebug pry-byebug

View File

@ -14,8 +14,8 @@ class OauthsController < ApplicationController
else else
begin begin
@user = create_from(provider) @user = create_from(provider)
# NOTE: this is the place to add '@user.activate!' # NOTE: this is the place to add '@user.activate!' if you
# if you are using user_activation submodule # are using user_activation submodule
reset_session # protect from session fixation attack reset_session # protect from session fixation attack
auto_login(@user) auto_login(@user)

View 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

View File

@ -0,0 +1,4 @@
class ApplicationMailer < ActionMailer::Base
default from: ENV['default_mail_from']
layout 'mailer'
end

View File

@ -0,0 +1,4 @@
!!!
%h3 Activate me please
%p and then: #{@blarg}

View File

@ -0,0 +1,3 @@
%hmtl
%body
= yield

View File

@ -0,0 +1 @@
= yield

View File

@ -21,5 +21,6 @@ module SmsPager
# Do not swallow errors in after_commit/after_rollback callbacks. # Do not swallow errors in after_commit/after_rollback callbacks.
config.active_record.raise_in_transactional_callbacks = true config.active_record.raise_in_transactional_callbacks = true
config.action_mailer.delivery_method = :mailjet
end end
end end

View 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

View File

@ -0,0 +1,7 @@
require 'test_helper'
class AccountMailerTest < ActionMailer::TestCase
# test "the truth" do
# assert true
# end
end

View File

@ -0,0 +1,3 @@
# Preview all emails at http://localhost:3000/rails/mailers/account_mailer
class AccountMailerPreview < ActionMailer::Preview
end