質問編集履歴

6

追記

2022/11/01 15:15

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -51,7 +51,7 @@
51
51
  (略)
52
52
  config.action_mailer.raise_delivery_errors = false
53
53
 
54
- config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
54
+ config.action_mailer.default_url_options = { host: 'localhost', port: 8080, protocol: 'https' }
55
55
  config.action_mailer.delivery_method = :letter_opener
56
56
  config.action_mailer.perform_deliveries = true
57
57
  (略)

5

追記

2022/11/01 03:42

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -35,8 +35,6 @@
35
35
 
36
36
  <%= render "users/shared/links" %>
37
37
  ```
38
- !追記
39
- エラー箇所のあるファイル
40
38
  ```views/users/mailer/reset_password.html.erb
41
39
  <p><%= t('.greeting', recipient: @resource.email) %></p>
42
40
 
@@ -58,9 +56,14 @@
58
56
  config.action_mailer.perform_deliveries = true
59
57
  (略)
60
58
  end
61
-
62
59
  ```
63
-
60
+ !追記
61
+ gemfileに下記を追加
62
+ ```
63
+ gem 'net-smtp'
64
+ gem 'net-imap'
65
+ gem 'net-pop'
66
+ ```
64
67
  参考サイト
65
68
  https://qiita.com/4ma9147/items/fc3f9fcf36572596fdf1
66
69
 

4

追記

2022/10/29 04:15

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -7,19 +7,9 @@
7
7
 
8
8
 
9
9
  ### 発生している問題・エラーメッセージ
10
- !letter_opener追加後のエラー
11
- ```
10
+ !追記
12
- ArgumentError at /users/password
11
+ エラーは消えたが、ポップアップが出現しませんでした。
13
- Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true
14
-
15
- _app_views_users_mailer_reset_password_instructions_html_erb___673584999610823065_67360app/views/users/mailer/reset_password_instructions.html.erb
16
-
17
- <p><%= t('.greeting', recipient: @resource.email) %></p>
18
- <p><%= t('.instruction') %></p>
12
+ 環境設定が間違っているのでしょうか?
19
- <p><%= link_to t('.action'), edit_password_url(@resource, reset_password_token: @token) %></p> ←エラー箇所
20
- <p><%= t('.instruction_2') %></p>
21
- <p><%= t('.instruction_3') %></p>
22
- ```
23
13
 
24
14
  ### 該当のソースコード
25
15
 
@@ -52,8 +42,7 @@
52
42
 
53
43
  <p><%= t('.instruction') %></p>
54
44
 
55
- <p><%= link_to t('.action'), edit_password_url(@resource, reset_password_token: @token) %></p>  ←エラー箇所
45
+ <p><%= link_to t('.action'), edit_password_url(@resource, reset_password_token: @token) %></p>
56
-
57
46
  <p><%= t('.instruction_2') %></p>
58
47
  <p><%= t('.instruction_3') %></p>
59
48
 
@@ -64,7 +53,7 @@
64
53
  (略)
65
54
  config.action_mailer.raise_delivery_errors = false
66
55
 
67
- # 開発環境でメールを送るためのホストの設定(Railsチュートリアル11章)
56
+ config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
68
57
  config.action_mailer.delivery_method = :letter_opener
69
58
  config.action_mailer.perform_deliveries = true
70
59
  (略)

3

追記

2022/10/28 13:10

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -7,6 +7,7 @@
7
7
 
8
8
 
9
9
  ### 発生している問題・エラーメッセージ
10
+ !letter_opener追加後のエラー
10
11
  ```
11
12
  ArgumentError at /users/password
12
13
  Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true
@@ -44,7 +45,8 @@
44
45
 
45
46
  <%= render "users/shared/links" %>
46
47
  ```
47
-
48
+ !追記
49
+ エラー箇所のあるファイル
48
50
  ```views/users/mailer/reset_password.html.erb
49
51
  <p><%= t('.greeting', recipient: @resource.email) %></p>
50
52
 

2

追記

2022/10/28 13:09

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -7,8 +7,18 @@
7
7
 
8
8
 
9
9
  ### 発生している問題・エラーメッセージ
10
+ ```
10
- メールを送るボタンを押すと、ログインページに飛ぶのですが、メールを確認してみても
11
+ ArgumentError at /users/password
12
+ Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true
13
+
14
+ _app_views_users_mailer_reset_password_instructions_html_erb___673584999610823065_67360app/views/users/mailer/reset_password_instructions.html.erb
15
+
16
+ <p><%= t('.greeting', recipient: @resource.email) %></p>
11
- パスワード再設定のメールが届きません。
17
+ <p><%= t('.instruction') %></p>
18
+ <p><%= link_to t('.action'), edit_password_url(@resource, reset_password_token: @token) %></p> ←エラー箇所
19
+ <p><%= t('.instruction_2') %></p>
20
+ <p><%= t('.instruction_3') %></p>
21
+ ```
12
22
 
13
23
  ### 該当のソースコード
14
24
 
@@ -36,15 +46,15 @@
36
46
  ```
37
47
 
38
48
  ```views/users/mailer/reset_password.html.erb
39
- <p>Hello <%= @resource.email %>!</p>
49
+ <p><%= t('.greeting', recipient: @resource.email) %></p>
40
50
 
41
- <p>Someone has requested a link to change your password. You can do this through the link below.</p>
51
+ <p><%= t('.instruction') %></p>
42
52
 
43
- # この下のルーティングだけ編集した。
44
- <p><%= link_to 'Change my password', edit_user_password_url(@resource, reset_password_token: @token) %></p>
53
+ <p><%= link_to t('.action'), edit_password_url(@resource, reset_password_token: @token) %></p>  ←エラー箇所
45
54
 
46
- <p>If you didn't request this, please ignore this email.</p>
55
+ <p><%= t('.instruction_2') %></p>
47
- <p>Your password won't change until you access the link above and create a new one.</p>
56
+ <p><%= t('.instruction_3') %></p>
57
+
48
58
  ```
49
59
 
50
60
  ```config\enviroments/development.rbの再設定に関するコード
@@ -53,8 +63,8 @@
53
63
  config.action_mailer.raise_delivery_errors = false
54
64
 
55
65
  # 開発環境でメールを送るためのホストの設定(Railsチュートリアル11章)
56
- host = 'localhost:3000'
57
- config.action_mailer.default_url_options = { host: host, protocol: 'http' }
66
+ config.action_mailer.delivery_method = :letter_opener
67
+ config.action_mailer.perform_deliveries = true
58
68
  (略)
59
69
  end
60
70
 
@@ -65,3 +75,8 @@
65
75
 
66
76
  初めてメールに関する機能を実施するため、至らない部分やメールを送る機能に関する理解が低い部分があると思いますが、アドバイスを頂けたらなと思っております。
67
77
 
78
+ !追記
79
+ 参考サイト
80
+ https://github.com/ryanb/letter_opener
81
+
82
+

1

ソースの追加

2022/10/20 11:28

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -60,5 +60,8 @@
60
60
 
61
61
  ```
62
62
 
63
+ 参考サイト
64
+ https://qiita.com/4ma9147/items/fc3f9fcf36572596fdf1
65
+
63
66
  初めてメールに関する機能を実施するため、至らない部分やメールを送る機能に関する理解が低い部分があると思いますが、アドバイスを頂けたらなと思っております。
64
67