Commit a986f463 by tady

compose html mail

parent b9a53535
...@@ -82,3 +82,7 @@ gem 'rack-mini-profiler' ...@@ -82,3 +82,7 @@ gem 'rack-mini-profiler'
# ref. https://github.com/popgiro/action-gmailer # ref. https://github.com/popgiro/action-gmailer
gem 'mail' gem 'mail'
gem 'action-gmailer', github: 'popgiro/action-gmailer' gem 'action-gmailer', github: 'popgiro/action-gmailer'
# compose html mail
gem 'nokogiri'
gem 'premailer'
...@@ -41,6 +41,7 @@ GEM ...@@ -41,6 +41,7 @@ GEM
multi_json (~> 1.3) multi_json (~> 1.3)
thread_safe (~> 0.1) thread_safe (~> 0.1)
tzinfo (~> 0.3.37) tzinfo (~> 0.3.37)
addressable (2.3.5)
ancestry (2.0.0) ancestry (2.0.0)
activerecord (>= 3.0.0) activerecord (>= 3.0.0)
arel (4.0.1) arel (4.0.1)
...@@ -60,6 +61,8 @@ GEM ...@@ -60,6 +61,8 @@ GEM
coffee-script-source coffee-script-source
execjs execjs
coffee-script-source (1.6.3) coffee-script-source (1.6.3)
css_parser (1.3.5)
addressable
daemons (1.1.9) daemons (1.1.9)
debug_inspector (0.0.2) debug_inspector (0.0.2)
devise (3.2.2) devise (3.2.2)
...@@ -77,6 +80,7 @@ GEM ...@@ -77,6 +80,7 @@ GEM
oauth (>= 0.3.6) oauth (>= 0.3.6)
hashie (2.0.5) hashie (2.0.5)
hike (1.2.3) hike (1.2.3)
htmlentities (4.3.1)
httpauth (0.2.0) httpauth (0.2.0)
i18n (0.6.9) i18n (0.6.9)
jbuilder (1.5.3) jbuilder (1.5.3)
...@@ -89,9 +93,12 @@ GEM ...@@ -89,9 +93,12 @@ GEM
mime-types (~> 1.16) mime-types (~> 1.16)
treetop (~> 1.4.8) treetop (~> 1.4.8)
mime-types (1.25.1) mime-types (1.25.1)
mini_portile (0.5.2)
minitest (4.7.5) minitest (4.7.5)
multi_json (1.8.2) multi_json (1.8.2)
multipart-post (1.2.0) multipart-post (1.2.0)
nokogiri (1.6.1)
mini_portile (~> 0.5.0)
oauth (0.4.7) oauth (0.4.7)
oauth2 (0.8.1) oauth2 (0.8.1)
faraday (~> 0.8) faraday (~> 0.8)
...@@ -111,6 +118,9 @@ GEM ...@@ -111,6 +118,9 @@ GEM
orm_adapter (0.5.0) orm_adapter (0.5.0)
pg (0.17.0) pg (0.17.0)
polyglot (0.3.3) polyglot (0.3.3)
premailer (1.7.9)
css_parser (>= 1.1.9)
htmlentities (>= 4.0.0)
rack (1.5.2) rack (1.5.2)
rack-mini-profiler (0.1.31) rack-mini-profiler (0.1.31)
rack (>= 1.1.3) rack (>= 1.1.3)
...@@ -186,8 +196,10 @@ DEPENDENCIES ...@@ -186,8 +196,10 @@ DEPENDENCIES
devise devise
jbuilder (~> 1.2) jbuilder (~> 1.2)
mail mail
nokogiri
omniauth-google-oauth2 omniauth-google-oauth2
pg pg
premailer
rack-mini-profiler rack-mini-profiler
rails (~> 4.0.2) rails (~> 4.0.2)
rails_12factor rails_12factor
......
...@@ -7,6 +7,7 @@ class PostsController < ApplicationController ...@@ -7,6 +7,7 @@ class PostsController < ApplicationController
before_action :require_login, except: [:index] before_action :require_login, except: [:index]
include ApplicationHelper include ApplicationHelper
include RV::Mailer
# GET /posts # GET /posts
# GET /posts.json # GET /posts.json
...@@ -55,9 +56,7 @@ class PostsController < ApplicationController ...@@ -55,9 +56,7 @@ class PostsController < ApplicationController
def mail def mail
@post = set_post @post = set_post
subject = @post.title compose_mail(@post, current_user).deliver
body = @post.body
RV::Mailer.compose_mail(subject, body, current_user).deliver
redirect_to root_path(id: @post.id) redirect_to root_path(id: @post.id)
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment