# Including a member first/surname in any email

**URL:** https://meta.discourse.org/t/including-a-member-first-surname-in-any-email/63121
**Category:** Support
**Created:** [2017 年 5 月 22 日午前 6:59 UTC](https://meta.discourse.org/t/including-a-member-first-surname-in-any-email/63121 "2017-05-22T06:59:06Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![roshni.duttagupta](https://avatars.discourse-cdn.com/v4/letter/r/839c29/32.png) [@roshni.duttagupta](https://meta.discourse.org/u/roshni.duttagupta)
#### Post date: [2017 年 5 月 22 日午前 6:59 UTC](https://meta.discourse.org/t/including-a-member-first-surname-in-any-email/63121/1 "2017-05-22T06:59:06Z")

</div>

Hi!  
Is there a way to include a member’s first name, surname or username in an email?

---

<div class="post-metadata">

### Author: ![robbyoconnor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/robbyoconnor/32/120330_2.png) [@robbyoconnor](https://meta.discourse.org/u/robbyoconnor)
#### Post date: [2017 年 5 月 22 日午前 7:37 UTC](https://meta.discourse.org/t/including-a-member-first-surname-in-any-email/63121/2 "2017-05-22T07:37:18Z")

</div>

> [@Customizable Email Templates](https://meta.discourse.org/t/customizable-email-templates/35818):
>
> Don’t like the text in our emails? Well now you can change them! (as long as you’re tracking our tests-passed branch) Just visit Admin \> Customize \> Email Templates and you’ll be presented with this nifty interface: Give it a whirl and let us know how it works out for you.

---

<div class="post-metadata">

### Author: ![roshni.duttagupta](https://avatars.discourse-cdn.com/v4/letter/r/839c29/32.png) [@roshni.duttagupta](https://meta.discourse.org/u/roshni.duttagupta)
#### Post date: [2017 年 5 月 22 日午前 8:00 UTC](https://meta.discourse.org/t/including-a-member-first-surname-in-any-email/63121/3 "2017-05-22T08:00:14Z")

</div>

Hi,

Thanks for the reply:)

Actually I was thinking of something like this:

Suppose my member’s name is Rebecca, I want my email to look like:

"Dear Rebecca,

Thanks for…"

Is there any any way to get this done?

Thanks

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [2017 年 5 月 22 日午後 2:23 UTC](https://meta.discourse.org/t/including-a-member-first-surname-in-any-email/63121/4 "2017-05-22T14:23:15Z")

</div>

The username should be  
%{username}

There are other topics about customizing emails with other examples

---

<div class="post-metadata">

### Author: ![BobbyZopfan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bobbyzopfan/32/149374_2.png) [@BobbyZopfan](https://meta.discourse.org/u/BobbyZopfan)
#### Post date: [2019 年 4 月 13 日午前 7:46 UTC](https://meta.discourse.org/t/including-a-member-first-surname-in-any-email/63121/5 "2019-04-13T07:46:43Z")

</div>

When I add this field in the welcome email (in other words, I, being the admin, when I edit the welcome email text and add this %{username} at the beginning of the email, it gives an error to the effect that:  
Body: The following interpolation keys are invalid: “username”.

What does this error mean and how to overcome it?

 ![image](https://global.discourse-cdn.com/meta/original/3X/a/1/a136b3f2c08930e00ee8a4ec7d1047aa910c7cee.png)

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [2019 年 4 月 26 日午前 9:25 UTC](https://meta.discourse.org/t/including-a-member-first-surname-in-any-email/63121/6 "2019-04-26T09:25:29Z")

</div>

> [@BobbyZopfan](#):
>
> What does this error mean and how to overcome it?

It means that the interpolation “`%{username}`” is not available for that string.

---

<div class="post-metadata">

### Author: ![BobbyZopfan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bobbyzopfan/32/149374_2.png) [@BobbyZopfan](https://meta.discourse.org/u/BobbyZopfan)
#### Post date: [2019 年 4 月 26 日午前 10:04 UTC](https://meta.discourse.org/t/including-a-member-first-surname-in-any-email/63121/7 "2019-04-26T10:04:58Z")

</div>

Can you be more specific?

As to what steps need i to take to resolve it?

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [2019 年 4 月 26 日午前 10:06 UTC](https://meta.discourse.org/t/including-a-member-first-surname-in-any-email/63121/8 "2019-04-26T10:06:59Z")

</div>

It means you can’t use “`%{username}`” in that text since it won’t be interpolated.

---

<div class="post-metadata">

### Author: ![BobbyZopfan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bobbyzopfan/32/149374_2.png) [@BobbyZopfan](https://meta.discourse.org/u/BobbyZopfan)
#### Post date: [2019 年 4 月 26 日午前 10:16 UTC](https://meta.discourse.org/t/including-a-member-first-surname-in-any-email/63121/9 "2019-04-26T10:16:42Z")

</div>

But @pfaffman is saying above that

> The username should be  
> %{username}

> [@zogstrip](#):
>
> It means that the interpolation “ `%{username}` ” is not available for that string

Do you mean that we can’t address a user by his name thru a template?

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [2019 年 4 月 26 日午前 10:33 UTC](https://meta.discourse.org/t/including-a-member-first-surname-in-any-email/63121/10 "2019-04-26T10:33:18Z")

</div>

So there’s some kind of bug here since you’ll never be able to use an interpolation that isn’t already available in the default english text. Even though we might have the code to allow you to use that interpolation.

@gerhard do you think it would be worth adding support for some default interpolations that would be available everywhere?

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [2019 年 4 月 26 日午前 10:54 UTC](https://meta.discourse.org/t/including-a-member-first-surname-in-any-email/63121/11 "2019-04-26T10:54:43Z")

</div>

> [@zogstrip](#):
>
> do you think it would be worth adding support for some default interpolations that would be available everywhere?

Everywhere? No. That has potential to break a couple of translations, because the i18n gem does different things when `I18n.t` is called with interpolation values. And it adds a small performance penalty. I wouldn’t want to go down that road.

But, we could extend the existing functionality that already allows certain interpolation keys for all `user_notifications.user_` translations even though they do not exist in the English strings.

> <https://github.com/discourse/discourse/blob/1852a95a41a9522d0ab29aa678dc4012c8f625dd/app/models/translation_override.rb#L4-L11>

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [2019 年 4 月 26 日午前 10:55 UTC](https://meta.discourse.org/t/including-a-member-first-surname-in-any-email/63121/12 "2019-04-26T10:55:38Z")

</div>

> [@gerhard](#):
>
> Everywhere? No.

I meant everywhere in email templates.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [2022 年 8 月 7 日午前 3:38 UTC](https://meta.discourse.org/t/including-a-member-first-surname-in-any-email/63121/13 "2022-08-07T03:38:48Z")

</div>



---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [2022 年 8 月 7 日午前 11:19 UTC](https://meta.discourse.org/t/including-a-member-first-surname-in-any-email/63121/14 "2022-08-07T11:19:18Z")

</div>


