blob: 7d46e268506a97d7836b9fab8bec80b9048c163a [file] [log] [blame]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001= Gerrit Code Review - Mail Templates
Martin Fickb7f3b2d2010-07-23 10:23:03 -06002
David Pursehouse98b60032017-04-04 15:19:59 +09003Gerrit uses link:https://developers.google.com/closure/templates/[Closure Templates]
4(Soy) for the bulk of the standard mails it sends out.
Martin Fickb7f3b2d2010-07-23 10:23:03 -06005There 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
Wyatt Allenbf0502c2016-10-18 13:47:43 -07009*Compatibility Note:* previously, Velocity Template Language (VTL) was used as
David Pursehousecb659782017-10-03 13:02:14 +010010the template language for Gerrit emails. Support for VTL has now been removed
11in favor of Soy, and Velocity templates that modify text emails are no longer
12supported.
Martin Fickb7f3b2d2010-07-23 10:23:03 -060013
David Pursehouse14b2d622018-05-01 15:45:39 +090014== Template Locations and Extensions
Martin Fickb7f3b2d2010-07-23 10:23:03 -060015
16The default example templates reside under: `'$site_path'/etc/mail` and are
Wyatt Allenbf0502c2016-10-18 13:47:43 -070017terminated with the double extension `.soy.example`. Modifying these example
Martin Fickb7f3b2d2010-07-23 10:23:03 -060018files will have no effect on the behavior of Gerrit. However, copying an
19example template to an equivalently named file without the `.example` extension
20and modifying it will allow an administrator to customize the template.
21
David Pursehouse14b2d622018-05-01 15:45:39 +090022== Supported Mail Templates
Martin Fickb7f3b2d2010-07-23 10:23:03 -060023
David Pursehouse221d4f62012-06-08 17:38:08 +090024Each mail that Gerrit sends out is controlled by at least one template. These
Martin Fickb7f3b2d2010-07-23 10:23:03 -060025are listed below. Change emails are influenced by two additional templates,
26one to set the subject line, and one to set the footer which gets appended to
Wyatt Allenbf0502c2016-10-18 13:47:43 -070027all the change emails (see `ChangeSubject.soy` and `ChangeFooter.soy` below.)
Martin Fickb7f3b2d2010-07-23 10:23:03 -060028
Wyatt Allenbf0502c2016-10-18 13:47:43 -070029Many types of Gerrit email message support HTML in addition to plain-text. Where
30both are supported, templates to control the HTML part have `...Html` appended
31in their file names. For example, for "Abandoned" emails, the `Abandoned.soy`
32template determines the text part of the message, whereas `AbandonedHtml.soy`
33determines the HTML part.
Martin Fick40ed99f2010-07-21 11:46:21 -060034
Wyatt Allenbf0502c2016-10-18 13:47:43 -070035=== Abandoned.soy and AbandonedHtml.soy
Martin Fick40ed99f2010-07-21 11:46:21 -060036
Wyatt Allenbf0502c2016-10-18 13:47:43 -070037The "Abandoned" templates will determine the contents of the email related to a
38change being abandoned. It is a `ChangeEmail`: see `ChangeSubject.soy` and
39ChangeFooter.
Doug Kelly251b1572015-08-25 11:02:04 -050040
Wyatt Allenbf0502c2016-10-18 13:47:43 -070041=== AddKey.soy and AddKeyHtml.soy
Doug Kelly251b1572015-08-25 11:02:04 -050042
Wyatt Allenbf0502c2016-10-18 13:47:43 -070043AddKey templates will determine the contents of the email related to SSH and GPG
44keys being added to a user account. This notification is not sent when the key
45is administratively added to another user account.
Martin Fick82bd12c2010-07-21 11:46:21 -060046
Wyatt Allenbf0502c2016-10-18 13:47:43 -070047=== ChangeFooter.soy and ChangeFooterHtml.soy
Martin Fick82bd12c2010-07-21 11:46:21 -060048
Wyatt Allenbf0502c2016-10-18 13:47:43 -070049The ChangeFooter templates will determine the contents of the footer that will
50be appended to emails related to changes (all `ChangeEmail`s).
Martin Fickb7f3b2d2010-07-23 10:23:03 -060051
Wyatt Allenbf0502c2016-10-18 13:47:43 -070052=== ChangeSubject.soy
53
54The `ChangeSubject.soy` template will determine the contents of the email
Martin Fickb7f3b2d2010-07-23 10:23:03 -060055subject line for ALL emails related to changes.
56
Wyatt Allenbf0502c2016-10-18 13:47:43 -070057=== Comment.soy
Martin Fick382e0a82010-07-27 17:09:33 -060058
Wyatt Allenbf0502c2016-10-18 13:47:43 -070059The `Comment.soy` template will determine the contents of the email related to
Martin Fick382e0a82010-07-27 17:09:33 -060060a user submitting comments on changes. It is a `ChangeEmail`: see
Wyatt Allenbf0502c2016-10-18 13:47:43 -070061`ChangeSubject.soy`, ChangeFooter and CommentFooter.
David Pursehouse85287c12012-09-24 20:58:21 +090062
Wyatt Allenbf0502c2016-10-18 13:47:43 -070063=== CommentFooter.soy and CommentFooterHtml.soy
David Pursehouse85287c12012-09-24 20:58:21 +090064
Wyatt Allenbf0502c2016-10-18 13:47:43 -070065The CommentFooter templates will determine the contents of the footer text that
66will be appended to emails related to a user submitting comments on changes.
67See `ChangeSubject.soy`, Comment and ChangeFooter.
Martin Fick382e0a82010-07-27 17:09:33 -060068
Paladox none04a17042019-04-22 13:47:29 +000069=== DeleteKey.soy and DeleteKeyHtml.soy
70
71DeleteKey templates will determine the contents of the email related to SSH or GPG keys
72being deleted from a user account. This notification is not sent when the key is
73administratively deleted from another user account.
74
Wyatt Allenbf0502c2016-10-18 13:47:43 -070075=== DeleteVote.soy and DeleteVoteHtml.soy
Khai Dof6b479a2015-12-08 23:44:34 -080076
Wyatt Allenbf0502c2016-10-18 13:47:43 -070077The DeleteVote templates will determine the contents of the email related to
78removing votes on changes. It is a `ChangeEmail`: see `ChangeSubject.soy`
79and ChangeFooter.
Khai Dof6b479a2015-12-08 23:44:34 -080080
Wyatt Allenbf0502c2016-10-18 13:47:43 -070081=== DeleteReviewer.soy and DeleteReviewerHtml.soy
Khai Do2710a882015-12-10 10:42:03 -080082
Wyatt Allenbf0502c2016-10-18 13:47:43 -070083The DeleteReviewer templates will determine the contents of the email related to
84a user removing a reviewer (with a vote) from a change. It is a
85`ChangeEmail`: see `ChangeSubject.soy` and ChangeFooter.
Khai Do2710a882015-12-10 10:42:03 -080086
Wyatt Allenbf0502c2016-10-18 13:47:43 -070087=== Footer.soy and FooterHtml.soy
David Pursehouse7a1d7c02013-06-05 12:22:45 +090088
Wyatt Allenbf0502c2016-10-18 13:47:43 -070089The Footer templates will determine the contents of the footer text appended to
90the end of all outgoing emails after the ChangeFooter and CommentFooter.
David Pursehouse7a1d7c02013-06-05 12:22:45 +090091
Paladox noned1898972019-04-22 14:39:33 +000092=== HttpPasswordUpdate.soy and HttpPasswordUpdateHtml.soy
93
94HttpPasswordUpdate templates will determine the contents of the email related to adding,
95changing or deleting the HTTP password on a user account.
96
Wyatt Allenbf0502c2016-10-18 13:47:43 -070097=== Merged.soy and MergedHtml.soy
Martin Fick7305be42010-07-23 17:31:26 -060098
Wyatt Allenbf0502c2016-10-18 13:47:43 -070099The Merged templates will determine the contents of the email related to a
100change successfully merged to the head. It is a `ChangeEmail`: see
101`ChangeSubject.soy` and ChangeFooter.
Martin Fick7305be42010-07-23 17:31:26 -0600102
Wyatt Allenbf0502c2016-10-18 13:47:43 -0700103=== NewChange.soy and NewChangeHtml.soy
Martin Fick679fc372010-07-21 11:46:21 -0600104
Wyatt Allenbf0502c2016-10-18 13:47:43 -0700105The NewChange templates will determine the contents of the email related to a
106user submitting a new change for review. This includes changes created by
107actions made by the user in the Web UI such as cherry picking a commit or
108reverting a change. It is a `ChangeEmail`: see `ChangeSubject.soy` and
109ChangeFooter.
Martin Fick679fc372010-07-21 11:46:21 -0600110
Wyatt Allenbf0502c2016-10-18 13:47:43 -0700111=== RegisterNewEmail.soy
Martin Fick679fc372010-07-21 11:46:21 -0600112
Wyatt Allenbf0502c2016-10-18 13:47:43 -0700113The `RegisterNewEmail.soy` template will determine the contents of the email
Martin Fick679fc372010-07-21 11:46:21 -0600114related to registering new email accounts.
115
Wyatt Allenbf0502c2016-10-18 13:47:43 -0700116=== ReplacePatchSet.soy and ReplacePatchSetHtml.soy
Martin Fick679fc372010-07-21 11:46:21 -0600117
Wyatt Allenbf0502c2016-10-18 13:47:43 -0700118The ReplacePatchSet templates will determine the contents of the email related
119to a user submitting a new patchset for a change. This includes patchsets
120created by actions made by the user in the Web UI such as editing the commit
121message, cherry picking a commit, or rebasing a change. It is a `ChangeEmail`:
122see `ChangeSubject.soy` and ChangeFooter.
Martin Fick40ed99f2010-07-21 11:46:21 -0600123
Wyatt Allenbf0502c2016-10-18 13:47:43 -0700124=== Restored.soy and RestoredHtml.soy
Martin Fick7759a6f2011-06-27 10:25:38 -0600125
Wyatt Allenbf0502c2016-10-18 13:47:43 -0700126The Restored templates will determine the contents of the email related to a
127change being restored. It is a `ChangeEmail`: see `ChangeSubject.soy` and
128ChangeFooter.
Martin Fick7759a6f2011-06-27 10:25:38 -0600129
Wyatt Allenbf0502c2016-10-18 13:47:43 -0700130=== Reverted.soy and RevertedHtml.soy
David Pursehouse8f4e01f2012-09-27 20:53:22 +0900131
Wyatt Allenbf0502c2016-10-18 13:47:43 -0700132The Reverted templates will determine the contents of the email related to a
133change being reverted. It is a `ChangeEmail`: see `ChangeSubject.soy` and
134ChangeFooter.
Martin Fick7759a6f2011-06-27 10:25:38 -0600135
Edwin Kempin49ab6f52016-12-07 10:40:32 +0100136=== SetAssignee.soy and SetAssigneeHtml.soy
137
138The SetAssignee templates will determine the contents of the email related to a
139user being assigned to a change. It is a `ChangeEmail`: see `ChangeSubject.soy`
140and ChangeFooter.
141
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600142
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800143== Mail Variables and Methods
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600144
145Mail templates can access and display objects currently made available to them
Wyatt Allenbf0502c2016-10-18 13:47:43 -0700146via the Soy context.
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600147
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800148=== Warning
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600149
David Pursehouse221d4f62012-06-08 17:38:08 +0900150Be aware that modifying templates can cause them to fail to parse and therefore
Wyatt Allenbf0502c2016-10-18 13:47:43 -0700151not send out the actual email.
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600152
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800153=== All OutgoingEmails
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600154
155All outgoing emails have the following variables available to them:
156
Wyatt Allenbf0502c2016-10-18 13:47:43 -0700157$email.settingsUrl::
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600158+
Wyatt Allenbf0502c2016-10-18 13:47:43 -0700159The URL to view the user's settings in the Gerrit web UI.
160
161$email.gerritHost::
162+
163The name of the Gerrit instance.
164
165$email.gerritUrl::
166+
167The URL to the Gerrit web UI.
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600168
169$messageClass::
170+
David Pursehouse221d4f62012-06-08 17:38:08 +0900171A String containing the messageClass.
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600172
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800173=== Change Emails
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600174
Wyatt Allenbf0502c2016-10-18 13:47:43 -0700175Change related emails have the following template data available to them, in
176addition to what's available to all outgoing emails.
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600177
178$changeId::
179+
David Pursehouse221d4f62012-06-08 17:38:08 +0900180Id of the current change (a `Change.Key`).
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600181
182$coverLetter::
183+
David Pursehouse221d4f62012-06-08 17:38:08 +0900184The text of the `ChangeMessage`.
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600185
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600186$fromName::
187+
David Pursehouse221d4f62012-06-08 17:38:08 +0900188The name of the from user.
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600189
Wyatt Allenbf0502c2016-10-18 13:47:43 -0700190$email.unifiedDiff::
191+
192The diff of the change.
193
194$email.changeDetail::
195+
196The details of the change, including the commit message.
197
198$email.changeUrl::
199+
200The URL to the change in the web UI.
201
202$email.includeDiff::
203+
204Whether the Gerrit instance is configured to include diffs in emails.
205
206$change.subject::
207+
208The subject of the current change.
209
210$change.originalSubject::
211+
212The subject corresponding to the first patch set of the current change.
213
214$change.shortSubject::
215+
Orgad Shaneh6add1772017-06-15 14:30:59 +0300216The subject limited to 72 characters, with an ellipsis if it exceeds that.
Wyatt Allenbf0502c2016-10-18 13:47:43 -0700217
Wyatt Allenea10a2392017-10-30 13:15:34 -0700218$change.shortOriginalSubject::
219+
220The original subject limited to 72 characters, with an ellipsis if it exceeds
221that.
222
Wyatt Allenbf0502c2016-10-18 13:47:43 -0700223$change.ownerEmail::
224+
225The email address of the owner of the change.
226
227$branch.shortName::
228+
229The name of the branch targeted by the current change.
230
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600231$projectName::
232+
David Pursehouse221d4f62012-06-08 17:38:08 +0900233The name of this change's project.
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600234
Wyatt Allenbf0502c2016-10-18 13:47:43 -0700235$shortProjectName::
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600236+
Wyatt Allenbf0502c2016-10-18 13:47:43 -0700237The project name with the path abbreviated.
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600238
xchangchengbfd75382018-04-30 14:04:55 +0000239$instanceAndProjectName::
Maxime Guerreiro8d129d42018-03-21 18:59:27 +0100240+
xchangchengbfd75382018-04-30 14:04:55 +0000241The Gerrit instance name, followed by the short project name
Maxime Guerreiro8d129d42018-03-21 18:59:27 +0100242
Maxime Guerreiroe7cc57d2018-04-24 18:15:04 +0000243$addInstanceNameInSubject::
244+
245Whether the instance name should be included in the email subject.
246
Wyatt Allenbf0502c2016-10-18 13:47:43 -0700247$sshHost::
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600248+
Wyatt Allenbf0502c2016-10-18 13:47:43 -0700249SSH hostname for the Gerrit instance.
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600250
Wyatt Allenbf0502c2016-10-18 13:47:43 -0700251$patchSet.patchSetId::
252+
253The current patch set number.
254
255$patchSet.refname::
256+
257The refname of the patch set.
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600258
Wyatt Allenf668f872017-10-12 14:19:57 -0700259$patchSetInfo.authorName::
260+
261The name of the author of the patch set.
262
263$patchSetInfo.authorEmail::
264+
265The email address of the author of the patch set.
266
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600267GERRIT
268------
269Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -0700270
271SEARCHBOX
272---------