Mailer error missing template

后端 未结 8 1022
谎友^
谎友^ 2021-02-18 21:25

Hello,

I have problem with ActionMailer, when I try to execute action:

rake send_email

I get a error:



        
8条回答
  •  旧巷少年郎
    2021-02-18 22:15

    class UserMailer < ActionMailer::Base
      default from: "from@example.com"
    
      layout "mailer"
    
      def mailer(user)
       @user = user
       mail(to: @user.email, subject: 'Test')
     end
    
    end
    

    Add a html layout under layout#

    mailer.html.erb

    
    
      
        
        
      
    
      
        <%= yield %>
      
    
    

    Add text layout under layout #

    mailer.text.erb

    <%= yield %>
    

    Use preview to check your email based on your test framework.

提交回复
热议问题