@@ -54,7 +54,7 @@ INVITATION_CODE=try-huginn |
||
54 | 54 |
# Outgoing email settings. To use Gmail or Google Apps, put your Google Apps domain or gmail.com |
55 | 55 |
# as the SMTP_DOMAIN and your Gmail username and password as the SMTP_USER_NAME and SMTP_PASSWORD. |
56 | 56 |
# |
57 |
-# PLEASE NOTE: In order to enable emails locally (e.g., when not in the production Rails environment), |
|
57 |
+# PLEASE NOTE: In order to enable sending real emails via SMTP locally (e.g., when not in the production Rails environment), |
|
58 | 58 |
# you must also set SEND_EMAIL_IN_DEVELOPMENT to true below. |
59 | 59 |
# |
60 | 60 |
# If you have trouble with port 587 on Gmail, you can also try setting |
@@ -68,7 +68,8 @@ SMTP_PORT=587 |
||
68 | 68 |
SMTP_AUTHENTICATION=plain |
69 | 69 |
SMTP_ENABLE_STARTTLS_AUTO=true |
70 | 70 |
|
71 |
-# Send emails when running in the development Rails environment. |
|
71 |
+# Set to true to send real emails via SMTP when running in the development Rails environment. |
|
72 |
+# Set to false to have emails intercepted in development and displayed at http://localhost:3000/letter_opener |
|
72 | 73 |
SEND_EMAIL_IN_DEVELOPMENT=false |
73 | 74 |
|
74 | 75 |
# The address from which system emails will appear to be sent. |
@@ -101,6 +101,7 @@ group :development do |
||
101 | 101 |
gem 'guard' |
102 | 102 |
gem 'guard-livereload' |
103 | 103 |
gem 'guard-rspec' |
104 |
+ gem 'letter_opener_web' |
|
104 | 105 |
|
105 | 106 |
group :test do |
106 | 107 |
gem 'coveralls', require: false |
@@ -234,6 +234,12 @@ GEM |
||
234 | 234 |
kramdown (1.3.3) |
235 | 235 |
launchy (2.4.2) |
236 | 236 |
addressable (~> 2.3) |
237 |
+ letter_opener (1.4.1) |
|
238 |
+ launchy (~> 2.2) |
|
239 |
+ letter_opener_web (1.3.0) |
|
240 |
+ actionmailer (>= 3.2) |
|
241 |
+ letter_opener (~> 1.0) |
|
242 |
+ railties (>= 3.2) |
|
237 | 243 |
libv8 (3.16.14.7) |
238 | 244 |
liquid (3.0.6) |
239 | 245 |
listen (2.7.9) |
@@ -529,6 +535,7 @@ DEPENDENCIES |
||
529 | 535 |
jsonpath (~> 0.5.6) |
530 | 536 |
kaminari (~> 0.16.1) |
531 | 537 |
kramdown (~> 1.3.3) |
538 |
+ letter_opener_web |
|
532 | 539 |
liquid (~> 3.0.3) |
533 | 540 |
mini_magick |
534 | 541 |
mqtt |
@@ -66,7 +66,9 @@ If you just want to play around, you can simply fork this repository, then perfo |
||
66 | 66 |
* Read the [wiki][wiki] for usage examples and to get started making new Agents. |
67 | 67 |
* Periodically run `git fetch upstream` and then `git checkout master && git merge upstream/master` to merge in the newest version of Huginn. |
68 | 68 |
|
69 |
-Note: by default, emails are not sent in the `development` Rails environment, which is what you just setup. If you'd like to enable emails when playing with Huginn locally, set `SEND_EMAIL_IN_DEVELOPMENT` to `true` in your `.env` file. |
|
69 |
+Note: By default, emails are intercepted in the `development` Rails environment, which is what you just setup. You can view |
|
70 |
+them at [http://localhost:3000/letter_opener](http://localhost:3000/letter_opener). If you'd like to send real emails via SMTP when playing |
|
71 |
+with Huginn locally, set `SEND_EMAIL_IN_DEVELOPMENT` to `true` in your `.env` file. |
|
70 | 72 |
|
71 | 73 |
If you need more detailed instructions, see the [Novice setup guide][novice-setup-guide]. |
72 | 74 |
|
@@ -39,8 +39,11 @@ Huginn::Application.configure do |
||
39 | 39 |
|
40 | 40 |
config.action_mailer.default_url_options = { :host => ENV['DOMAIN'] } |
41 | 41 |
config.action_mailer.asset_host = ENV['DOMAIN'] |
42 |
- config.action_mailer.perform_deliveries = ENV['SEND_EMAIL_IN_DEVELOPMENT'] == 'true' |
|
43 | 42 |
config.action_mailer.raise_delivery_errors = true |
44 |
- config.action_mailer.delivery_method = :smtp |
|
43 |
+ if ENV['SEND_EMAIL_IN_DEVELOPMENT'] == 'true' |
|
44 |
+ config.action_mailer.delivery_method = :smtp |
|
45 |
+ else |
|
46 |
+ config.action_mailer.delivery_method = :letter_opener |
|
47 |
+ end |
|
45 | 48 |
# smtp_settings moved to config/initializers/action_mailer.rb |
46 | 49 |
end |
@@ -74,6 +74,10 @@ Huginn::Application.routes.draw do |
||
74 | 74 |
devise_for :users, |
75 | 75 |
controllers: { omniauth_callbacks: 'omniauth_callbacks' }, |
76 | 76 |
sign_out_via: [:post, :delete] |
77 |
+ |
|
78 |
+ if Rails.env.development? |
|
79 |
+ mount LetterOpenerWeb::Engine, at: "/letter_opener" |
|
80 |
+ end |
|
77 | 81 |
|
78 | 82 |
get "/about" => "home#about" |
79 | 83 |
root :to => "home#index" |
@@ -46,7 +46,7 @@ INVITATION_CODE=try-huginn |
||
46 | 46 |
# Outgoing email settings. To use Gmail or Google Apps, put your Google Apps domain or gmail.com |
47 | 47 |
# as the SMTP_DOMAIN and your Gmail username and password as the SMTP_USER_NAME and SMTP_PASSWORD. |
48 | 48 |
# |
49 |
-# PLEASE NOTE: In order to enable emails locally (e.g., when not in the production Rails environment), |
|
49 |
+# PLEASE NOTE: In order to enable sending real emails via SMTP locally (e.g., when not in the production Rails environment), |
|
50 | 50 |
# you must also set SEND_EMAIL_IN_DEVELOPMENT to true below. |
51 | 51 |
|
52 | 52 |
SMTP_DOMAIN=your-domain-here.com |
@@ -57,7 +57,8 @@ SMTP_PORT=587 |
||
57 | 57 |
SMTP_AUTHENTICATION=plain |
58 | 58 |
SMTP_ENABLE_STARTTLS_AUTO=true |
59 | 59 |
|
60 |
-# Send emails when running in the development Rails environment. |
|
60 |
+# Set to true to send real emails via SMTP when running in the development Rails environment. |
|
61 |
+# Set to false to have emails intercepted in development and displayed at http://localhost:3000/letter_opener |
|
61 | 62 |
SEND_EMAIL_IN_DEVELOPMENT=false |
62 | 63 |
|
63 | 64 |
# The address from which system emails will appear to be sent. |