-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaction_mailer.rb
38 lines (33 loc) · 1.53 KB
/
action_mailer.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# >--------------------------------[ action_mailer ]--------------------------------<
# Application template recipe. Check for a newer version here:
# https://github.com/fortuity/rails-template-recipes/blob/master/action_mailer.rb
say_recipe 'ActionMailer configuration'
# modifying environment configuration files for ActionMailer
gsub_file 'config/environments/development.rb', /# Don't care if the mailer can't send/, '# ActionMailer Config'
gsub_file 'config/environments/development.rb', /config.action_mailer.raise_delivery_errors = false/ do
<<-RUBY
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
# A dummy setup for development - no deliveries, but logged
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = false
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default :charset => "utf-8"
RUBY
end
gsub_file 'config/environments/production.rb', /config.active_support.deprecation = :notify/ do
<<-RUBY
config.active_support.deprecation = :notify
config.action_mailer.default_url_options = { :host => 'yourhost.com' }
# ActionMailer Config
# Setup for production - deliveries, no errors raised
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = false
config.action_mailer.default :charset => "utf-8"
RUBY
end
if extra_recipes.include? 'git'
git :tag => "ActionMailer_config"
git :add => '.'
git :commit => "-am 'Set ActionMailer configuration.'"
end