現在、Rails API サーバーでメーラーをセットアップしようとしています。現在、次のエラーが発生します。ActionView::MissingTemplate (Missing template user_mailer/welcome_email with "mailer". Searched in:
* "user_mailer"
):
現在、次の場所にビューがありますviews/user_mailer/welcome_email.html.erb
私users_mailer.rb
の見た目は次のとおりです。
class UserMailer < ApplicationMailer
default from: 'xx@xxx.com'
def welcome_email(user)
@user = user
@url = 'http://0.0.0.0:3000/login'
mail(to: 'xxx@xxxxx.com', subject: 'Welcome to the site')
end
end
私のコントローラーは、次のようにメーラーを呼び出します。
def show
UserMailer.welcome_email(@user).deliver_now
render json: @user
end
config.api_only = false
運が悪いので設定してみました。