# Issue with mail notification

**URL:** <https://www.ruby-forum.com/t/issue-with-mail-notification/183036>\
**Category:** Rails I18n\
**Created:** [February 6, 2010, 5:38pm UTC](https://www.ruby-forum.com/t/issue-with-mail-notification/183036 "2010-02-06T17:38:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kadoudal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f0a364/32.png) [@kadoudal](https://www.ruby-forum.com/u/kadoudal)\
**Post date:** [February 6, 2010, 5:38pm UTC](https://www.ruby-forum.com/t/issue-with-mail-notification/183036/1 "2010-02-06T17:38:59Z")

</div>

Rails 2.3.5 / Ruby 1.8.7

Hi All

I have a small issue when using mail notification

my default locale is :en (but I have already 2 locales :en , :fr for  
testing purpose

I have a Notifier model …  
class Notifier \< ActionMailer::Base  
…  
def activation\_instructions(user)  
debugger  
subject I18n.t(“mail.subject.activation\_instructions”)  
from Setting.mail\_from  
recipients user.email  
sent\_on Time.now  
body :account\_activation\_url =\>  
register\_url(user.perishable\_token)  
body :account\_type =\> I18n.t(“label.#{user.type}”, :count  
=\> 1)  
end

all labels comes in English , that’s fine…  
BUT  
I have 2 views …  
activation\_instructions.html.erb  
activation\_instructions.fr.html.erb

and I always get the french version email (with the english labels in  
it…) …  
it should be the english one (default)  
what’s wrong… ?

thanks for your enlightments !!

---

<div class="post-metadata">

**Author:** ![kadoudal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f0a364/32.png) [@kadoudal](https://www.ruby-forum.com/u/kadoudal)\
**Post date:** [February 6, 2010, 5:41pm UTC](https://www.ruby-forum.com/t/issue-with-mail-notification/183036/2 "2010-02-06T17:41:54Z")

</div>

try to rename the english version to →   
activation\_instructions.en.html.erb

2010/2/6 Erwin [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

> class Notifier \< ActionMailer::Base  
> =\> 1)  
> it should be the english one (default)  
> removed\_email\_address@domain.invalid[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> .  
> For more options, visit this group at  
> [http://groups.google.com/group/rails-i18n?hl=en](http://groups.google.com/group/rails-i18n?hl=en).

–  
Experiencia es lo que obtienes, cuando no obtienes lo que quieres.

---

<div class="post-metadata">

**Author:** ![kadoudal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f0a364/32.png) [@kadoudal](https://www.ruby-forum.com/u/kadoudal)\
**Post date:** [February 6, 2010, 6:30pm UTC](https://www.ruby-forum.com/t/issue-with-mail-notification/183036/3 "2010-02-06T18:30:28Z")

</div>

ActionMailer by default supports full content-type extensions e.g:  
text.plain.erb, text.html.erb, so you should follow this convention,  
otherwise your fr.html is taken as content type (“fr/html”).

And your templates should be named:

activation\_instructions.text.html.erb  
activation\_instructions.fr.text.html.erb

Regards,  
KK

2010/2/6 Erwin [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![kadoudal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f0a364/32.png) [@kadoudal](https://www.ruby-forum.com/u/kadoudal)\
**Post date:** [February 6, 2010, 6:33pm UTC](https://www.ruby-forum.com/t/issue-with-mail-notification/183036/4 "2010-02-06T18:33:24Z")

</div>

and…

activation\_instructions.text.plain.erb  
activation\_instructions.fr.text.plain.erb

if plain text message in enough for you. If you have both plain and  
html, ActionMailer builds multipart/alternative email.

KK

2010/2/6 Krzysztof K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![kadoudal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f0a364/32.png) [@kadoudal](https://www.ruby-forum.com/u/kadoudal)\
**Post date:** [February 7, 2010, 9:07am UTC](https://www.ruby-forum.com/t/issue-with-mail-notification/183036/5 "2010-02-07T09:07:11Z")

</div>

It seems not to be working…  
no problem when I get rid of the locale extension…  
activation\_instructions.text.html.erb works  
activation\_instructions.fr.text.html.erb doesn’t work

but I discover this info :

> **[Localized ActionMailer Templates for Rails](http://blog.andischacke.com/2009/10/localized-actionmailer-templates-for.html)**
>
> Rails actually does support localized templates, however, this does not apply for localized ActionMailer templates (yet?). Even if you add t...

:-))
