Sending confirmation emails to registered users in ROR app via localhost

前端 未结 3 664
时光取名叫无心
时光取名叫无心 2020-12-20 07:21

In my ROR app, I am trying to send confirmation emails to my registered users when they signup, my website is on localhost currently. I am getting this error:



        
3条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-20 07:53

    This is your user_mailer.rb

    user_mailer.rb
    
    class UserMailer < ActionMailer::Base
      def registration_confirmation(user)
        recipients   user.email
        from         "myemailid@gmail.com"
        subject      "Thank you for registration"
        body         :user => user  
      end
    

    Try instead:

    class UserMailer < ActionMailer::Base
      default from: "myemailid@gmail.com"
    
      def registration_confirmation(user)
        mail(to: user.email, subject: "Thank you for registration")
      end
    end
    

    And set up the appropriate view in views/user_mailer e.g. registration_confirmation.html.erb

提交回复
热议问题