blob: 656f7401a23f2c9b32c6788acb2067710e828a7f [file] [log] [blame]
Martin Fickb7f3b2d2010-07-23 10:23:03 -06001Gerrit Code Review - Mail Templates
2===================================
3
4Gerrit uses velocity templates for the bulk of the standard mails it sends out.
5There are builtin default templates which are used if they are not overridden.
6These defaults are also provided as examples so that administrators may copy
7them and easily modify them to tweak their contents.
8
9
10Template Locations and Extensions:
11----------------------------------
12
13The default example templates reside under: `'$site_path'/etc/mail` and are
14terminated with the double extension `.vm.example`. Modifying these example
15files will have no effect on the behavior of Gerrit. However, copying an
16example template to an equivalently named file without the `.example` extension
17and modifying it will allow an administrator to customize the template.
18
19
20Supported Mail Templates:
21-------------------------
22
23Each mail that Gerrit sends out is controlled by at least one template, these
24are listed below. Change emails are influenced by two additional templates,
25one to set the subject line, and one to set the footer which gets appended to
26all the change emails (see `ChangeSubject.vm` and `ChangeFooter.vm` below.)
27
28ChangeSubject.vm
29~~~~~~~~~~~~~~~~
30
31The `ChangeSubject.vm` template will determine the contents of the email
32subject line for ALL emails related to changes.
33
34
35Mail Variables and Methods
36--------------------------
37
38Mail templates can access and display objects currently made available to them
39via the velocity context. While the base objects are documented here, it is
40possible to call public methods on these objects from templates. Those methods
41are not documented here since they could change with every release. As these
42templates are meant to be modified only by a qualified sysadmin, it is accepted
43that writing templates for Gerrit emails is likely to require some basic
44knowledge of the class structure to be useful. Browsing the source code might
45be necessary for anything more than a minor formatting change.
46
47Warning
48~~~~~~~
49
50Be aware that modifying templates can cause them to fail to parse and therefor
51not send out the actual email, or worse, calling methods on the available
52objects could have internal side effects which would adversely affect the
53health of your Gerrit server and/or data.
54
55All OutgoingEmails
56~~~~~~~~~~~~~~~~~~
57
58All outgoing emails have the following variables available to them:
59
60$email::
61+
62A reference to the class constructing the current `OutgoingEmail`. With this
63reference it is possible to call any public method on the OutgoingEmail class
64or the current child class inherited from it.
65
66$messageClass::
67+
68A String containing the messageClass
69
70$StringUtils::
71+
72A reference to the Apache `StringUtils` class. This can be very useful for
73formatting strings.
74
75Change Emails
76~~~~~~~~~~~~~
77
78All change related emails have the following additional variables available to them:
79
80$change::
81+
82A reference to the current `Change` object
83
84$changeId::
85+
86Id of the current change (a `Change.Key`)
87
88$coverLetter::
89+
90The text of the `ChangeMessage`
91
92$branch::
93+
94A reference to the branch of this change (a `Branch.NameKey`)
95
96$fromName::
97+
98The name of the from user
99
100$projectName::
101+
102The name of this change's project
103
104$patchSet::
105+
106A reference to the current `PatchSet`
107
108$patchSetInfo::
109+
110A reference to the current `PatchSetInfo`
111
112
113See Also
114--------
115
116* link:http://velocity.apache.org/[velocity]
117
118GERRIT
119------
120Part of link:index.html[Gerrit Code Review]