質問編集履歴

2

コントローラーとメイラーの中身を公開しました

2016/11/08 19:56

投稿

teruwa
teruwa

スコア49

test CHANGED
File without changes
test CHANGED
@@ -40,7 +40,7 @@
40
40
 
41
41
  def thanks
42
42
 
43
- # メール送信
43
+
44
44
 
45
45
  @inquiry = Inquiry.new(params[:inquiry])
46
46
 
@@ -48,7 +48,7 @@
48
48
 
49
49
 
50
50
 
51
- # 完了画面を表示
51
+
52
52
 
53
53
  render :action => 'thanks'
54
54
 

1

コントローラーとメイラーの内部を開示しました(役に立つ情報な気がしまして。。。)

2016/11/08 19:56

投稿

teruwa
teruwa

スコア49

test CHANGED
File without changes
test CHANGED
@@ -27,3 +27,53 @@
27
27
 
28
28
 
29
29
  とても困っております、どうか皆様のお知恵お貸しくださいませ・・・
30
+
31
+
32
+
33
+
34
+
35
+ 追記;
36
+
37
+ エラーが出ているコントローラーの中身と、
38
+
39
+ class InquiryController < ApplicationController
40
+
41
+ def thanks
42
+
43
+ # メール送信
44
+
45
+ @inquiry = Inquiry.new(params[:inquiry])
46
+
47
+ InquiryMailer.received_email(@inquiry).deliver
48
+
49
+
50
+
51
+ # 完了画面を表示
52
+
53
+ render :action => 'thanks'
54
+
55
+ end
56
+
57
+
58
+
59
+ メイラーの中身です・・・
60
+
61
+ class InquiryMailer < ActionMailer::Base
62
+
63
+ default from: "-------@gmail.com" # 送信元アドレス
64
+
65
+ default to: "-------@gmail.com" # 送信先アドレス
66
+
67
+
68
+
69
+ def received_email(inquiry)
70
+
71
+ @inquiry = inquiry
72
+
73
+ mail(:subject => 'お問い合わせを承りました')
74
+
75
+ end
76
+
77
+
78
+
79
+ end