Mail templating, hopefully

This commit is contained in:
Yuki 2015-07-21 23:43:14 +05:30
parent e76871b75f
commit 362292716f
6 changed files with 35 additions and 2 deletions

19
app/mailers/retromail.rb Normal file
View File

@ -0,0 +1,19 @@
class Retromail < Devise::Mailer
helper :application
include Devise::Controllers::UrlHelpers
default template_path: 'devise/mailer', parts_order: [ 'text/plain', 'text/html' ]
layout 'mail'
def devise_mail(record, action, opts={})
initialize_from_record(record)
mail(headers_for(action, opts)) do |format|
format.txt
format.html
end
end
def confirmation_instructions(record, token, opts={})
@token = token
devise_mail(record, :confirmation_instructions, opts)
end
end

View File

@ -0,0 +1,6 @@
Welcome to <%= APP_CONFIG['site_name'] %>, <%= @resource.screen_name %>!
You can confirm your account email by copying link below,
and entering it into your browser.
<%= confirmation_url(@resource, confirmation_token: @token, protocol: (APP_CONFIG['https'] ? :https : :http)) %>

View File

@ -0,0 +1,5 @@
%style{type: "text/css"} p{margin:0;padding:0;}*,div,small,span,body{font-family:Arial;}
%div{style: 'background: #5e35b1; padding: 5px; padding-left: 10px; font-size: 25px; color: white; font-family: Arial; width: 800px; margin: 0;'}= APP_CONFIG['site_name']
%div{style: 'border: #5e35b1 5px solid; padding: 5px; border-top: none; background: white; color: black; font-family: Arial; width: 795px; margin: 0;'}
= yield
%small{style: 'color: grey; display: block; width: 800px; text-align: center;'} © 2015 Retrospring

View File

@ -0,0 +1,3 @@
<%= yield %>
© 2015 Retrospring

View File

@ -13,7 +13,7 @@ Devise.setup do |config|
config.mailer_sender = "#{APP_CONFIG['site_name']} <#{APP_CONFIG['email_from']}>"
# Configure the class responsible to send e-mails.
# config.mailer = 'Devise::Mailer'
config.mailer = 'Retromail'
# ==> ORM configuration
# Load and configure the ORM. Supports :active_record (default) and