ruby on railsでActionMailerを使いました。
http://ruby-rails.hatenadiary.com/entry/20140828/1409236436
これに書かれている通り自分のプロジェクトに合わせて設定したのですが
(Gmailで設定しました)
Completed 500 Internal Server Error in 70ms (ActiveRecord: 9.7ms)
SocketError (getaddrinfo: 名前またはサービスが不明です)
とエラーになります。
どう対処したらいいですか?
追記
記事を投稿する際にエラーが起こります。(記事は保存されます)
メールのセッティングは
app/meilers/post_mailer.rb
default from: "from@example.com"
def post_email(user,post)
@user = user
mail to: "@user.email", subject: "記事を投稿しました。"
end
app/Views/post_mailer/post_email.html.erb
app/Views/post_mailer/post_email.text.erb
こちらは参考にしたサイトと全く一緒です。
controllers/posts_controller.rb
def create
@user=current_user
@post =Post.new(post_params)
@post.user_id = @user.id
if @post.save
PostMailer.post_email(@user,@post).deliver
redirect_to posts_path
else
render :new
end
end
回答2件
あなたの回答
tips
プレビュー