# Access to user or employee on email template

**URL:** https://discuss.tryton.org/t/access-to-user-or-employee-on-email-template/3988
**Category:** Developer
**Created:** [March 30, 2021, 9:15am UTC](https://discuss.tryton.org/t/access-to-user-or-employee-on-email-template/3988 "2021-03-30T09:15:29Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![timitos](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/timitos/32/323_2.png) [@timitos](https://discuss.tryton.org/u/timitos)
#### Post date: [March 30, 2021, 9:15am UTC](https://discuss.tryton.org/t/access-to-user-or-employee-on-email-template/3988/1 "2021-03-30T09:15:29Z")

</div>

In email templates it would be good to have access to the name current user or its employee. What is the right way to achieve this?

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [March 30, 2021, 9:27am UTC](https://discuss.tryton.org/t/access-to-user-or-employee-on-email-template/3988/2 "2021-03-30T09:27:13Z")

</div>

You can extend `EmailTemplate.eval` to add more contextual values.  
But do not forget that the signature of the user already added to the email.

---

<div class="post-metadata">

### Author: ![timitos](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/timitos/32/323_2.png) [@timitos](https://discuss.tryton.org/u/timitos)
#### Post date: [March 30, 2021, 9:41am UTC](https://discuss.tryton.org/t/access-to-user-or-employee-on-email-template/3988/3 "2021-03-30T09:41:31Z")

</div>

I am not sure if this will work. I want to use the value inside the body of the template. But only the record itself is available on generation of the TextTemplate.

I know about the signature but normally you would sign off an email like

> With regards,  
> Mr. X

and this comes before the signature.

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [March 30, 2021, 9:58am UTC](https://discuss.tryton.org/t/access-to-user-or-employee-on-email-template/3988/4 "2021-03-30T09:58:13Z")

</div>

> [@timitos](#):
>
> I am not sure if this will work. I want to use the value inside the body of the template. But only the record itself is available on generation of the TextTemplate.

Indeed `EmailTemplate.eval` does not allow you to change the evaluation environment.  
We could imagine make this extendable even if I think there are almost no case where it should be needed.

> [@timitos](#):
>
> I know about the signature but normally you would sign off an email like
> 
> > With regards,  
> > Mr. X
> 
> and this comes before the signature.

What is the point to repeat your name just above the signature ?

---

<div class="post-metadata">

### Author: ![timitos](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/timitos/32/323_2.png) [@timitos](https://discuss.tryton.org/u/timitos)
#### Post date: [March 30, 2021, 10:23am UTC](https://discuss.tryton.org/t/access-to-user-or-employee-on-email-template/3988/5 "2021-03-30T10:23:29Z")

</div>

> [@ced](#):
>
> What is the point to repeat your name just above the signature ?

Its just not looking good to have a separator between the text of the email and the closing formula.  
And there are a lot of people that still want to have there email correspondence look like a well written letter.

I would appreciate to have the possibility to extend the evaluation environment.

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [March 30, 2021, 10:35am UTC](https://discuss.tryton.org/t/access-to-user-or-employee-on-email-template/3988/6 "2021-03-30T10:35:04Z")

</div>

> [@timitos](#):
>
> And there are a lot of people that still want to have there email correspondence look like a well written letter.

This is email not letter. They must embrace the correct format instead.

---

<div class="post-metadata">

### Author: ![timitos](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/timitos/32/323_2.png) [@timitos](https://discuss.tryton.org/u/timitos)
#### Post date: [March 30, 2021, 10:39am UTC](https://discuss.tryton.org/t/access-to-user-or-employee-on-email-template/3988/7 "2021-03-30T10:39:22Z")

</div>

> [@ced](#):
>
> This is email not letter. They must embrace the correct format instead.

Can you point me to a source that explain that valid format?

I did some research before starting this thread and i didn’t find any reliable source describing such a valid format that is dealing with the topic that the closing of the email should be or should not be part of the signature. Currently Tryton handles the signature like a signature file from an email client and I still think that the closing of the email should not be part of such a signature file.

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [March 30, 2021, 10:45am UTC](https://discuss.tryton.org/t/access-to-user-or-employee-on-email-template/3988/8 "2021-03-30T10:45:50Z")

</div>

With a quick search I found: [How to End a Business Email W/ a Professional Closing (+ Tips) | Envato Tuts+](https://business.tutsplus.com/articles/how-to-end-a-business-email-with-a-professional-closing--cms-29097)

The signature as you said is the standard way that most email client are using.

---

<div class="post-metadata">

### Author: ![timitos](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/timitos/32/323_2.png) [@timitos](https://discuss.tryton.org/u/timitos)
#### Post date: [March 30, 2021, 11:09am UTC](https://discuss.tryton.org/t/access-to-user-or-employee-on-email-template/3988/9 "2021-03-30T11:09:11Z")

</div>

With a quick search I found this one that describes my version:

> **[Moved Temporarily](https://www.syntaxis.com/moved)**
>
> This area of the Syntaxis website is currently under (re)construction, but please come back soon!

So which one is the right one? I think that there is not really a consensus on this topic.

---

<div class="post-metadata">

### Author: ![htgoebel](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/htgoebel/32/1256_2.png) [@htgoebel](https://discuss.tryton.org/u/htgoebel)
#### Post date: [March 31, 2021, 4:28pm UTC](https://discuss.tryton.org/t/access-to-user-or-employee-on-email-template/3988/10 "2021-03-31T16:28:41Z")

</div>

> [@ced](#):
>
> This is email not letter. They must embrace the correct format instead.

Most users are not aware of this convention. And often receivers are complaining about this style being unfriendly.

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [April 1, 2021, 11:17am UTC](https://discuss.tryton.org/t/access-to-user-or-employee-on-email-template/3988/11 "2021-04-01T11:17:17Z")

</div>

Indeed `EmailTemplate.eval` is for the PYSON expression like the recipients. It is the context of `TextTemplate.generate` that should be extendable.
