Render Different View (template) for ActionMailer

You shouldn’t try to do anything after you call mail(). However, to choose another template, you should pass :template_name as an option. For example:

template = @user.is_photographer ? "welcome_photographer" : "welcome"
mail(:to => "#{@user.name} <#{@user.email}>", 
     :subject => "Welcome to ...", 
     :template_name => template)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)