###前提・実現したいこと
Ruby On Railsで自動メール機能をつけたい
###試したこと
Ruby On Railsでメール機能をつけようと思っています。
gmailでのメール送信はできたのですが、さくらサーバーのメールアドレスでテストしたところなかなか上手く行かずにいます。。
###該当のソースコード
config/environments/deveropment.rb
Rails.application.configure do . . . config.action_mailer.raise_delivery_errors = true config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { port: 995, address: 'smtp.hoge.sakura.ne.jp', domain: 'smtp.hoge.sakura.ne.jp', user_name: 'info@hoge.sakura.ne.jp', password: '**********', authentication: 'plain', enable_starttls_auto: true } end
app/mailers/application_mailer.rb
class ApplicationMailer < ActionMailer::Base default from: "info@hoge.sakura.ne.jp" layout 'mailer' end
app/mailers/notification_mailer.rb
class NotificationMailer < ApplicationMailer default from: "info@hoge.sakura.ne.jp"#送信元のメールアドレス設定 def send_confirm_to_user(contact) @contact = contact mail( subject: "メールを受けました", to: @contact.email #宛先 ) do |format| format.text end end def send_notice_to_hoge(contact) @contact = contact mail( subject: "メールが来ました。", to: "info@hoge.sakura.ne.jp" #宛先 ) do |format| format.text end end end
###補足情報(言語/FW/ツール等のバージョンなど)
さくらサーバーで独自ドメインを取っています。
deveropment.rbの設定部分なのではないかと思っているのですが、なかなか上手く行かずにいます。。
初心者ですがどうぞよろしくお願いいたします。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。