Custom mail templates are ignored, but registered #10586

Closed
opened 2025-11-02 09:12:02 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @dsvictory on GitHub (Apr 2, 2023).

Description

After creating some custom templates (issue/comment.tmpl and issue/default.tmpl) with minimal html I see their registration in logs but they are never used. With any actions in gitea I always get the same built-in template in my mail. There are no fails or any other errors in logs. All is ok, but custom mail templates don't work. And I tried it with all other action types and names.

My trace logs after gitea launching:

2023/04/02 19:41:46 .../templates/mailer.go:46:func1() [T] Adding built-in mailer template for auth/reset_passwd
2023/04/02 19:41:46 .../templates/mailer.go:46:func1() [T] Adding built-in mailer template for auth/activate
2023/04/02 19:41:46 .../templates/mailer.go:46:func1() [T] Adding built-in mailer template for team_invite
2023/04/02 19:41:46 .../templates/mailer.go:46:func1() [T] Adding built-in mailer template for auth/activate_email
2023/04/02 19:41:46 .../templates/mailer.go:46:func1() [T] Adding built-in mailer template for release
2023/04/02 19:41:46 .../templates/mailer.go:46:func1() [T] Adding built-in mailer template for issue/default
2023/04/02 19:41:46 .../templates/mailer.go:46:func1() [T] Adding built-in mailer template for auth/register_notify
2023/04/02 19:41:46 .../templates/mailer.go:46:func1() [T] Adding built-in mailer template for issue/assigned
2023/04/02 19:41:46 .../templates/mailer.go:46:func1() [T] Adding built-in mailer template for notify/repo_transfer
2023/04/02 19:41:46 .../templates/mailer.go:68:1() [T] Adding mailer template for \issue\comment from "C:\gitea\custom\templates\mail\issue\comment.tmpl"
2023/04/02 19:41:46 .../templates/mailer.go:68:1() [T] Adding mailer template for \issue\default from "C:\gitea\custom\templates\mail\issue\default.tmpl"
2023/04/02 19:41:46 ...s/process/manager.go:170:Add() [T] Start 6429780a-21: Queue: notification-service-channel (system)
2023/04/02 19:41:46 ...s/process/manager.go:170:Add() [T] Start 6429780a-20: Watcher: Mailer Templates (system)
2023/04/02 19:41:46 ...les/queue/manager.go:149:Add() [T] Queue Manager registered: notification-service-channel (QID: 4)
2023/04/02 19:41:46 ...s/watcher/watcher.go:48:run() [T] [6429780a-20] Watcher loop starting for Mailer Templates
2023/04/02 19:41:46 ...s/process/manager.go:170:Add() [T] Start 6429780a-22: Queue: notification-service-level (system)
2023/04/02 19:41:46 ...les/queue/manager.go:149:Add() [T] Queue Manager registered: notification-service-level (QID: 5)
2023/04/02 19:41:46 ...s/watcher/watcher.go:60:func1() [T] [6429780a-20] Watcher: Mailer Templates watching "C:\gitea\custom\templates\mail"
2023/04/02 19:41:46 ...les/queue/manager.go:149:Add() [T] Queue Manager registered: notification-service (QID: 6)
2023/04/02 19:41:46 ...ueue_disk_channel.go:159:Run() [D] [6429780a-21] PersistableChannelQueue: notification-service Starting
2023/04/02 19:41:46 .../queue/workerpool.go:283:commonRegisterWorkers() [T] [6429780a-21] WorkerPool: 4 (for notification-service-channel) adding 0 workers with group id: 1
2023/04/02 19:41:46 ...ueue_disk_channel.go:196:Run() [D] [6429780a-21] PersistableChannelQueue: notification-service Skipping running the empty level queue
2023/04/02 19:41:46 ...ue/queue_bytefifo.go:327:Shutdown() [T] [6429780a-21] level: notification-service-level Shutting down
2023/04/02 19:41:46 ...ue/queue_bytefifo.go:334:Shutdown() [D] [6429780a-21] level: notification-service-level Shutdown
2023/04/02 19:41:46 ...les/queue/manager.go:158:Remove() [T] [6429780a-21] Queue Manager removed: QID: 5
2023/04/02 19:41:46 ...s/process/manager.go:170:Add() [T] Start 6429780a-23: Queue: repo-archive-channel (system)
2023/04/02 19:41:46 ...s/watcher/watcher.go:60:func1() [T] [6429780a-20] Watcher: Mailer Templates watching "C:\gitea\custom\templates\mail\issue"
2023/04/02 19:41:46 ...les/queue/manager.go:149:Add() [T] Queue Manager registered: repo-archive-channel (QID: 7)
2023/04/02 19:41:46 ...s/process/manager.go:170:Add() [T] Start 6429780a-24: Queue: repo-archive-level (system)
2023/04/02 19:41:46 ...les/queue/manager.go:149:Add() [T] Queue Manager registered: repo-archive-level (QID: 8)
2023/04/02 19:41:46 ...s/watcher/watcher.go:60:func1() [T] [6429780a-20] Watcher: Mailer Templates watching "C:\gitea\custom\templates\mail\issue\comment.tmpl"
2023/04/02 19:41:46 ...les/queue/manager.go:149:Add() [T] Queue Manager registered: repo-archive (QID: 9)
2023/04/02 19:41:46 ...ueue_disk_channel.go:188:Run() [D] [6429780a-23] PersistableChannelUniqueQueue: repo-archive Starting
2023/04/02 19:41:46 .../queue/workerpool.go:283:commonRegisterWorkers() [T] [6429780a-23] WorkerPool: 7 (for repo-archive-channel) adding 0 workers with group id: 1
2023/04/02 19:41:46 ...ueue_disk_channel.go:234:Run() [D] [6429780a-23] PersistableChannelUniqueQueue: repo-archive Skipping running the empty level queue
2023/04/02 19:41:46 .../queue/workerpool.go:283:commonRegisterWorkers() [T] [6429780a-23] WorkerPool: 8 (for repo-archive-level) adding 1 workers with group id: 1
2023/04/02 19:41:46 ...s/watcher/watcher.go:60:func1() [T] [6429780a-20] Watcher: Mailer Templates watching "C:\gitea\custom\templates\mail\issue\default.tmpl"

My templates are registered without any problems as I see.
From logs after commenting PR:

2023/04/02 19:44:34 ...ces/mailer/mailer.go:101:NewMessageFrom() [T] [642978b2] NewMessageFrom (body):

<head>

	<style>
		blockquote { padding-left: 1em; margin: 1em 0; border-left: 1px solid grey; color: #777}
		.footer { font-size:small; color:#666;}
		
	</style>

</head>

<body>
	
	
	<p>
		
			<p>Test comment in PR</p>

		
	</p>
	<div class="footer">
	<p>
		---
		<br>
		<a href="https://oggs.npr.nornick.ru:3000/DenisovVE/test/issues/3#issuecomment-67">View it on Gitea: Git with a cup of tea</a>.
	</p>
	</div>
</body>
</html>

2023/04/02 19:44:35 ...ces/mailer/mailer.go:376:func1() [T] [6429780a-18] New e-mail sending request [denisovve@nornik.ru]: Subject: Re: [DenisovVE/test] Test1 (#3), issue comments

And logs itself:
gitea.log

My custom templates' bodies are only Comment and Default. I've changed .tmpl extensions to .txt to have possibility to add templates here.

comment.txt
default.txt

In all cases I always get this:

Screenshot 2023-04-02 153825

It's just a minimal html, but previously I've tried with small changing built-in templates and using as my custom template too. No useful result. And there are no any errors in logs.

Gitea Version

1.19.0

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

2.24.1.windows.2

Operating System

Windows Server 2016 (v. 1607 build 14393.5648)

How are you running Gitea?

As Windows Service or just launching .exe itself. Result is the same.

Database

MSSQL

Originally created by @dsvictory on GitHub (Apr 2, 2023). ### Description After creating some custom templates (issue/comment.tmpl and issue/default.tmpl) with minimal html I see their registration in logs but they are never used. With any actions in gitea I always get the same built-in template in my mail. There are no fails or any other errors in logs. All is ok, but custom mail templates don't work. And I tried it with all other action types and names. My trace logs after gitea launching: 2023/04/02 19:41:46 .../templates/mailer.go:46:func1() [T] Adding built-in mailer template for auth/reset_passwd 2023/04/02 19:41:46 .../templates/mailer.go:46:func1() [T] Adding built-in mailer template for auth/activate 2023/04/02 19:41:46 .../templates/mailer.go:46:func1() [T] Adding built-in mailer template for team_invite 2023/04/02 19:41:46 .../templates/mailer.go:46:func1() [T] Adding built-in mailer template for auth/activate_email 2023/04/02 19:41:46 .../templates/mailer.go:46:func1() [T] Adding built-in mailer template for release 2023/04/02 19:41:46 .../templates/mailer.go:46:func1() [T] Adding built-in mailer template for issue/default 2023/04/02 19:41:46 .../templates/mailer.go:46:func1() [T] Adding built-in mailer template for auth/register_notify 2023/04/02 19:41:46 .../templates/mailer.go:46:func1() [T] Adding built-in mailer template for issue/assigned 2023/04/02 19:41:46 .../templates/mailer.go:46:func1() [T] Adding built-in mailer template for notify/repo_transfer 2023/04/02 19:41:46 .../templates/mailer.go:68:1() [T] Adding mailer template for \issue\comment from "C:\\gitea\\custom\\templates\\mail\\issue\\comment.tmpl" 2023/04/02 19:41:46 .../templates/mailer.go:68:1() [T] Adding mailer template for \issue\default from "C:\\gitea\\custom\\templates\\mail\\issue\\default.tmpl" 2023/04/02 19:41:46 ...s/process/manager.go:170:Add() [T] Start 6429780a-21: Queue: notification-service-channel (system) 2023/04/02 19:41:46 ...s/process/manager.go:170:Add() [T] Start 6429780a-20: Watcher: Mailer Templates (system) 2023/04/02 19:41:46 ...les/queue/manager.go:149:Add() [T] Queue Manager registered: notification-service-channel (QID: 4) 2023/04/02 19:41:46 ...s/watcher/watcher.go:48:run() [T] [6429780a-20] Watcher loop starting for Mailer Templates 2023/04/02 19:41:46 ...s/process/manager.go:170:Add() [T] Start 6429780a-22: Queue: notification-service-level (system) 2023/04/02 19:41:46 ...les/queue/manager.go:149:Add() [T] Queue Manager registered: notification-service-level (QID: 5) 2023/04/02 19:41:46 ...s/watcher/watcher.go:60:func1() [T] [6429780a-20] Watcher: Mailer Templates watching "C:\\gitea\\custom\\templates\\mail" 2023/04/02 19:41:46 ...les/queue/manager.go:149:Add() [T] Queue Manager registered: notification-service (QID: 6) 2023/04/02 19:41:46 ...ueue_disk_channel.go:159:Run() [D] [6429780a-21] PersistableChannelQueue: notification-service Starting 2023/04/02 19:41:46 .../queue/workerpool.go:283:commonRegisterWorkers() [T] [6429780a-21] WorkerPool: 4 (for notification-service-channel) adding 0 workers with group id: 1 2023/04/02 19:41:46 ...ueue_disk_channel.go:196:Run() [D] [6429780a-21] PersistableChannelQueue: notification-service Skipping running the empty level queue 2023/04/02 19:41:46 ...ue/queue_bytefifo.go:327:Shutdown() [T] [6429780a-21] level: notification-service-level Shutting down 2023/04/02 19:41:46 ...ue/queue_bytefifo.go:334:Shutdown() [D] [6429780a-21] level: notification-service-level Shutdown 2023/04/02 19:41:46 ...les/queue/manager.go:158:Remove() [T] [6429780a-21] Queue Manager removed: QID: 5 2023/04/02 19:41:46 ...s/process/manager.go:170:Add() [T] Start 6429780a-23: Queue: repo-archive-channel (system) 2023/04/02 19:41:46 ...s/watcher/watcher.go:60:func1() [T] [6429780a-20] Watcher: Mailer Templates watching "C:\\gitea\\custom\\templates\\mail\\issue" 2023/04/02 19:41:46 ...les/queue/manager.go:149:Add() [T] Queue Manager registered: repo-archive-channel (QID: 7) 2023/04/02 19:41:46 ...s/process/manager.go:170:Add() [T] Start 6429780a-24: Queue: repo-archive-level (system) 2023/04/02 19:41:46 ...les/queue/manager.go:149:Add() [T] Queue Manager registered: repo-archive-level (QID: 8) 2023/04/02 19:41:46 ...s/watcher/watcher.go:60:func1() [T] [6429780a-20] Watcher: Mailer Templates watching "C:\\gitea\\custom\\templates\\mail\\issue\\comment.tmpl" 2023/04/02 19:41:46 ...les/queue/manager.go:149:Add() [T] Queue Manager registered: repo-archive (QID: 9) 2023/04/02 19:41:46 ...ueue_disk_channel.go:188:Run() [D] [6429780a-23] PersistableChannelUniqueQueue: repo-archive Starting 2023/04/02 19:41:46 .../queue/workerpool.go:283:commonRegisterWorkers() [T] [6429780a-23] WorkerPool: 7 (for repo-archive-channel) adding 0 workers with group id: 1 2023/04/02 19:41:46 ...ueue_disk_channel.go:234:Run() [D] [6429780a-23] PersistableChannelUniqueQueue: repo-archive Skipping running the empty level queue 2023/04/02 19:41:46 .../queue/workerpool.go:283:commonRegisterWorkers() [T] [6429780a-23] WorkerPool: 8 (for repo-archive-level) adding 1 workers with group id: 1 2023/04/02 19:41:46 ...s/watcher/watcher.go:60:func1() [T] [6429780a-20] Watcher: Mailer Templates watching "C:\\gitea\\custom\\templates\\mail\\issue\\default.tmpl" My templates are registered without any problems as I see. From logs after commenting PR: 2023/04/02 19:44:34 ...ces/mailer/mailer.go:101:NewMessageFrom() [T] [642978b2] NewMessageFrom (body): <!DOCTYPE html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Re: [DenisovVE/test] Test1 (# 3)</title> <style> blockquote { padding-left: 1em; margin: 1em 0; border-left: 1px solid grey; color: #777} .footer { font-size:small; color:#666;} </style> </head> <body> <p> <p>Test comment in PR</p> </p> <div class="footer"> <p> --- <br> <a href="https://oggs.npr.nornick.ru:3000/DenisovVE/test/issues/3#issuecomment-67">View it on Gitea: Git with a cup of tea</a>. </p> </div> </body> </html> 2023/04/02 19:44:35 ...ces/mailer/mailer.go:376:func1() [T] [6429780a-18] New e-mail sending request [denisovve@nornik.ru]: Subject: Re: [DenisovVE/test] Test1 (#3), issue comments **And logs itself:** [gitea.log](https://github.com/go-gitea/gitea/files/11132269/gitea.log) My custom templates' bodies are only Comment and Default. I've changed .tmpl extensions to .txt to have possibility to add templates here. [comment.txt](https://github.com/go-gitea/gitea/files/11132302/comment.txt) [default.txt](https://github.com/go-gitea/gitea/files/11132303/default.txt) In all cases I always get this: <img width="219" alt="Screenshot 2023-04-02 153825" src="https://user-images.githubusercontent.com/49069848/229354931-efb38f4e-6d1a-4e7f-9df3-f5ebdc37b12d.png"> It's just a minimal html, but previously I've tried with small changing built-in templates and using as my custom template too. No useful result. And there are no any errors in logs. ### Gitea Version 1.19.0 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version 2.24.1.windows.2 ### Operating System Windows Server 2016 (v. 1607 build 14393.5648) ### How are you running Gitea? As Windows Service or just launching .exe itself. Result is the same. ### Database MSSQL
GiteaMirror added the type/bug label 2025-11-02 09:12:02 -06:00
Author
Owner

@dsvictory commented on GitHub (Apr 12, 2023):

Issue is closed because of the solving the problems in https://github.com/go-gitea/gitea/issues/24075.

@dsvictory commented on GitHub (Apr 12, 2023): Issue is closed because of the solving the problems in https://github.com/go-gitea/gitea/issues/24075.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#10586