Customizing the e-mail content of notifications

72 views
Skip to first unread message

Mo

unread,
Jan 27, 2017, 3:17:53 AM1/27/17
to Trac Users
Hi,

according to
https://trac.edgewall.org/wiki/TracNotification#Customizingthee-mailcontent
I already adapted the layout of the notification mails.

Is it possible to integrate some code there like editing $change.comment?
I like to cut some macros that are less human-readable like

In [changeset:"cbdb65b2227380011d391520a15ab6b94227a76d/mt5" cbdb75b/mm3]:
{{{
#!CommitTicketReference repository="mm3" revision="cbdb65b2227380011d391520a15ab6b94227a76d"
[ticket #222] tests needed
Cleanup

[git-p4: depot-paths = "//MM3/": change = 411345]
}}}

Another approach but apparently requiring more efforts would be to generate a HTML mail that would use the trac wiki engine to render such content.

BR,
Mo

RjOllos

unread,
Jan 27, 2017, 5:50:11 AM1/27/17
to Trac Users


On Friday, January 27, 2017 at 12:17:53 AM UTC-8, Mo wrote:
Hi,

according to
https://trac.edgewall.org/wiki/TracNotification#Customizingthee-mailcontent
I already adapted the layout of the notification mails.

Is it possible to integrate some code there like editing $change.comment?
I like to cut some macros that are less human-readable like

In [changeset:"cbdb65b2227380011d391520a15ab6b94227a76d/mt5" cbdb75b/mm3]:
{{{
#!CommitTicketReference repository="mm3" revision="cbdb65b2227380011d391520a15ab6b94227a76d"
[ticket #222] tests needed
Cleanup

[git-p4: depot-paths = "//MM3/": change = 411345]
}}}

You could checkout the documentation for the text template language (1). There's an example of inline python code on the page you cited (2).
 
Another approach but apparently requiring more efforts would be to generate a HTML mail that would use the trac wiki engine to render such content.

Mo

unread,
Feb 9, 2017, 6:18:44 AM2/9/17
to Trac Users
Am Freitag, 27. Januar 2017 11:50:11 UTC+1 schrieb RjOllos:

Have you looked at TracHtmlNotificationPlugin?
 

I have installed that and it works for me. Reloading the preference page, the text/plain settings is there again, it does not seem to reflect my current setting, but it works, I get html mails.
However I can't get it working for other users. Do they need some permissions?

Where is the setting stored for the user so I can analyse if the setting is stored? The users save the text/html setting but still get plain mails. This is Trac-1.2.

Peter Suter

unread,
Feb 9, 2017, 12:05:25 PM2/9/17
to trac-...@googlegroups.com
See https://trac.edgewall.org/ticket/11928

When users have no subscription saving the format doesn't work.
For default subscriptions you can now pre-configure the format in trac.ini [notification-subscriber] section by setting ....format = text/html I think.

Reply all
Reply to author
Forward
0 new messages