こんにちは。
現在プログラミングをしており問い合わせフォームを作成しております。
しかしデータを送信すると以下の認証エラーが発生します。
確認してもどこも問題なさそうなのですが、間違いの点わかりましたら指摘頂けないでしょうか?
よろしくお願い致します。
development
1 config.action_mailer.default_url_options = { :host => 'localhost:3000' } 2 config.action_mailer.raise_delivery_errors = true 3 4 ActionMailer::Base.delivery_method = :smtp 5 ActionMailer::Base.smtp_settings = { 6 address: '###.jp', 7 domain: 'domain.jp', 8 port: 587, 9 user_name: '##@domain.jp', 10 password: 'PASS', 11 authentication: 'plain', 12 enable_starttls_auto: true 13 }
class ContactMailer < ActionMailer::Base default from: "##" default to: "##" def received_email(contact) @contact = contact mail(subject: 'webサイトよりメッセージが届きました') do |format| format.text end end end
class ContactController < ApplicationController def index @contact = Contact.new render :action => 'index' end def confirm @contact = Contact.new(contact_params) if @contact.valid? render :action => 'confirm' else render :action => 'index' end end def thanks @contact = Contact.new(contact_params) ContactMailer.received_email(@contact).deliver_now end private def contact_params params.require(:contact).permit( :company, #会社名 :name, #代表者名 :tel, #電話番号 :address, #住所 :email, #メールアドレス :message ) end end
##.jpからお問い合わせがありました。 -------------------------- Company: <%= @contact.company %> Name: <%= @contact.name %> Tel: <%= @contact.tel %> Email: <%= @contact.email %> Address: <%= @contact.address %> Message: <%= @contact.message %> --------------------------
user_name と password はあっているかをメーラーなどで確認してますか?
あなたの回答
tips
プレビュー