teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

4

inquiry_controller.rbを追記

2021/08/31 12:09

投稿

kawanoonigiri
kawanoonigiri

スコア14

title CHANGED
File without changes
body CHANGED
@@ -17,8 +17,8 @@
17
17
  ```
18
18
 
19
19
  ### 該当のソースコード
20
- development.rb
20
+ development.rb
21
- ```
21
+ ```ruby
22
22
  config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
23
23
  config.action_mailer.raise_delivery_errors = true
24
24
  config.action_mailer.delivery_method = :smtp
@@ -33,6 +33,31 @@
33
33
  }
34
34
 
35
35
  ```
36
+ inquiry_controller.rb
37
+ ```ruby
38
+ class InquiryController < ApplicationController
39
+ def index
40
+ @inquiry = Inquiry.new
41
+ render :index
42
+ end
43
+
44
+ def confirm
45
+ @inquiry = Inquiry.new(params[:inquiry].permit(:name, :email, :message))
46
+ if @inquiry.valid?
47
+ render :confirm
48
+ else
49
+ render :index
50
+ end
51
+ end
52
+
53
+ def thanks
54
+ @inquiry = Inquiry.new(params[:inquiry].permit(:name, :email, :message))
55
+ InquiryMailer.received_email(@inquiry).deliver
56
+ render :thanks
57
+ end
58
+ end
59
+ ```
60
+
36
61
  上記、user_nameとパスワードは伏せてあります。
37
62
 
38
63
  設定方法お詳しい方いらっしゃいましたら、ご教授いただけますと大変助かります。

3

コードの記述ファイル名追記

2021/08/31 12:09

投稿

kawanoonigiri
kawanoonigiri

スコア14

title CHANGED
File without changes
body CHANGED
@@ -17,7 +17,7 @@
17
17
  ```
18
18
 
19
19
  ### 該当のソースコード
20
-
20
+ development.rb
21
21
  ```
22
22
  config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
23
23
  config.action_mailer.raise_delivery_errors = true

2

誤字の修正

2021/08/31 10:09

投稿

kawanoonigiri
kawanoonigiri

スコア14

title CHANGED
File without changes
body CHANGED
@@ -22,7 +22,7 @@
22
22
  config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
23
23
  config.action_mailer.raise_delivery_errors = true
24
24
  config.action_mailer.delivery_method = :smtp
25
- config.action_mailer.amtp_settings = {
25
+ config.action_mailer.smtp_settings = {
26
26
  address: 'smtp.gmail.com',
27
27
  port: 587,
28
28
  domain: 'gmail.com',

1

説明文の追記

2021/08/31 09:10

投稿

kawanoonigiri
kawanoonigiri

スコア14

title CHANGED
File without changes
body CHANGED
@@ -5,7 +5,7 @@
5
5
  下記サイトを元にアプリパスワードを生成しています。
6
6
  [2段階認証に未対応のアプリからのログイン用にアプリパスワードを生成する](https://www.howtonote.jp/google-account/2step-verify/index6.html#section2)
7
7
 
8
- また、アプリパスワードをメールに設定するため指示通り探してみるもわからない状態です。
8
+ また、アプリパスワードをメールに設定するため指示通り「アカウント情報」内で「パスワード入力」欄を探してみるもわからない状態です。
9
9
  [Googleアカウントの指示](https://gyazo.com/e38d36fa0025f0674a8f438d5ba9ed88)
10
10
 
11
11
  ### 発生している問題・エラーメッセージ