# Help with changing the subjects of notification emails

**URL:** <https://forum.gitea.com/t/help-with-changing-the-subjects-of-notification-emails/8010>\
**Category:** Install/Maintain/Configure\
**Created:** [October 26, 2023, 9:42pm UTC](https://forum.gitea.com/t/help-with-changing-the-subjects-of-notification-emails/8010 "2023-10-26T21:42:35Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![sepsol](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/sepsol/32/4120_2.png) [@sepsol](https://forum.gitea.com/u/sepsol)\
**Post date:** [October 26, 2023, 9:42pm UTC](https://forum.gitea.com/t/help-with-changing-the-subjects-of-notification-emails/8010/1 "2023-10-26T21:42:35Z")

</div>

I am trying to modify the subject lines of emails sent out from my self-hosted gitea instance (`v1.20.5` via `docker-compose`).

I am following this page in the docs: [Mail templates | Gitea Documentation](https://docs.gitea.com/administration/mail-templates). I have ran `gitea embedded extract --destination /data/gitea templates/mail/**` and modified one of the downloaded templates and added this line at the very top:

```auto
Test Subject
---
<!DOCTYPE html>
<body>
...
</body>

```

And then I ran `docker compose restart` to restart the gitea server. But my changes to the subject line are disregarded and `.FallbackSubject` from the metadata context is used. I have tested and I have no issue modifying the email body, it’s just the email subject.

Any help would be highly appreciated, thanks!

---

<div class="post-metadata">

**Author:** ![sepsol](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/sepsol/32/4120_2.png) [@sepsol](https://forum.gitea.com/u/sepsol)\
**Post date:** [October 27, 2023, 4:18pm UTC](https://forum.gitea.com/t/help-with-changing-the-subjects-of-notification-emails/8010/2 "2023-10-27T16:18:42Z")

</div>

I’ve played around with it a bit more, read more pages from the gitea docs and the golang’s template engine. I really doubt I am doing anything wrong here, I’m more inclined to believe this is a bug with gitea, therefore I’ve opened an issue on github here:

> <https://github.com/go-gitea/gitea/issues/27793>
>
> \### Description
> 
> Hello, I am trying to modify the subject lines of emails sent o…ut from my self-hosted gitea instance (via \`docker-compose\`). 
> 
> I am following this page in the docs: https://docs.gitea.com/administration/mail-templates. I have ran \`gitea embedded extract --destination /data/gitea templates/mail/\*\*\` and modified one of the downloaded templates and added this line at the very top:
> 
> \`\`\`
> Test Subject
> \---
> \<!DOCTYPE html\>
> \<body\>
> ...
> \</body\>
> \`\`\`
> 
> And then I ran \`docker compose restart\` to restart the gitea server. But my changes to the subject line are disregarded and \`.FallbackSubject\` from the metadata context is used. I have tested and I have no issue modifying the email body, it's just the email subject.
> 
> Any help would be highly appreciated, thanks!
> 
> \### Gitea Version
> 
> 1.20.5
> 
> \### Can you reproduce the bug on the Gitea demo site?
> 
> No
> 
> \### Log Gist
> 
> \_No response\_
> 
> \### Screenshots
> 
> \_No response\_
> 
> \### Git Version
> 
> 2.40.1
> 
> \### Operating System
> 
> Debian 12
> 
> \### How are you running Gitea?
> 
> I followed this guide to create \`gitea\` with \`postgres\` using \`docker-compose\`:
> https://docs.gitea.com/installation/install-with-docker#postgresql-database
> 
> \### Database
> 
> PostgreSQL

---

<div class="post-metadata">

**Author:** ![sepsol](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/sepsol/32/4120_2.png) [@sepsol](https://forum.gitea.com/u/sepsol)\
**Post date:** [October 30, 2023, 4:13pm UTC](https://forum.gitea.com/t/help-with-changing-the-subjects-of-notification-emails/8010/3 "2023-10-30T16:13:15Z")

</div>

I have posted my issue on all of the official channels and still have got not a single word in response. Could someone please let me know if this is acknowledged?

---

<div class="post-metadata">

**Author:** ![jake](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@jake](https://forum.gitea.com/u/jake)\
**Post date:** [October 30, 2023, 11:29pm UTC](https://forum.gitea.com/t/help-with-changing-the-subjects-of-notification-emails/8010/4 "2023-10-30T23:29:49Z")

</div>

If you put `{{.Subject}}` somewhere in body of mail template, does it output `Test Subject` or is it empty?

---

<div class="post-metadata">

**Author:** ![sepsol](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/sepsol/32/4120_2.png) [@sepsol](https://forum.gitea.com/u/sepsol)\
**Post date:** [October 31, 2023, 1:16am UTC](https://forum.gitea.com/t/help-with-changing-the-subjects-of-notification-emails/8010/5 "2023-10-31T01:16:51Z")

</div>

@jake It seems like I got nothing back. See the attached screenshot. I did restart the gitea container after modifying the template as well.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/gitea/original/2X/b/b03f454954ae20712e246e8d814af1362f72219f.png)

P.S:

- The template I’m modifying is in `/data/gitea/templates/mail/auth/register_notify.tmpl`.
- According to `gitea help` my `CustomPath` is `/data/gitea`

---

<div class="post-metadata">

**Author:** ![dicki](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dicki](https://forum.gitea.com/u/dicki)\
**Post date:** [December 17, 2023, 12:06am UTC](https://forum.gitea.com/t/help-with-changing-the-subjects-of-notification-emails/8010/6 "2023-12-17T00:06:12Z")

</div>

@jake  
If I put `{{.Subject}}` somewhere in body of mail template. It output nothing. Seems this is a bug. I have tried 200 times and with many different way but still does not work. Please help.

Thanks,  
Dicki

---

<div class="post-metadata">

**Author:** ![jake](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@jake](https://forum.gitea.com/u/jake)\
**Post date:** [December 25, 2023, 5:25pm UTC](https://forum.gitea.com/t/help-with-changing-the-subjects-of-notification-emails/8010/7 "2023-12-25T17:25:45Z")

</div>

It is a bug, see issue filed by OP above ([Cannot change email subjects · Issue #27793 · go-gitea/gitea · GitHub](https://github.com/go-gitea/gitea/issues/27793)).

According to user on that issue,

> That’s a bug. Seems like Gitea only applies this `---` subject to `issue` related mail while others just use the default one. So our results are both reasonable now.

They create pull request [Add custom subject for all kinds of mail templates by lng2020 · Pull Request #27861 · go-gitea/gitea · GitHub](https://github.com/go-gitea/gitea/pull/27861) to solve issue, but it has not been merged yet. May be available in 1.22 or 1.23 if it does get merged, I think unlikely it will be backported to 1.21 since it is very niche.
