evanx
evanx

Reputation: 1301

how to send emails in multiple languages with Rails Actionmailer?

I have my site in two languages (English and Spanish). I have form when the user submit it it sends an an HTML e-mail(in English) to his e-mail account.

How can configure my actionmailer so it can send the user the e-mail in the right language?

I've created the views

confirmation_email.es.html.erb
confirmation_email.en.html.erb

Where do I specify which template to use?

Upvotes: 0

Views: 1006

Answers (1)

phoet
phoet

Reputation: 18845

this should be automatically handled by rails template resolution.

try the following to send in spanish:

  I18n.with_locale :es do
    UserMailer.confirmation_email(user).deliver!
  end

Upvotes: 2

Related Questions