You are not logged in. Click here to log in.

codebeamer Application Lifecycle Management (ALM)

Search In Project

Search inClear

Customizing Notification Emails


Email content generated by Codebeamer is completely customizable.
The templates that are used to render the emails are found in the CODEBEAMER_HOME/tomcat/webapps/cb/config/templates/email directory. There is one set of 3 files for each email type:
  1. a Groovy script (see *.groovy files) that determines whether emails are sent or not
  2. a Velocity template (see *_subject.vm files) to specify the subject of the email
  3. a Velocity template (see *_body.vm files) to specify the body of the email

Customizing the Email Content

Velocity is a powerful, yet simple template technology. For general information about the Velocity template language, read Velocity Engine Manual. CodeBeamer supports every feature available in Velocity (conditions, cycles, arithmetic, etc.).
The templates can be modified on-the-fly, there is no need to restart the container (Tomcat).

Velocity context for each Email Type

The following beans can be used in the email templates. These are available both in the subject and body templates.

Email TypeObjects
Anyoriginator (who performed the action),
remoteAddress (if available)
artifact_* artifact,
contentUpdated (boolean flag),
lost_passwordpassword (String),
homeSite (URL as String)
comment (String)
scc_modification_committedcommit (the changeset itself),
send_emailbody (String)
modificationComment and modificationCommentFormat (if comment is not empty),
modifiedProperties (collection)
user_*user (the actual account the email is related to, it's not identical with the originator!)
wikipage_comment_createdsame as for artifact_comment_created
wikipage_*same as for artifact_*, but wikiPage instead of artifact

Note that for the nested object (e.g. trackerItem.tracker), only the id and name properties are fetched for performance reasons.


To display the project name in the subject of tracker issue creation emails, modify tracker_item_created_notification_email_subject.vm as:

New CB Tracker Item in ${} "${trackerItem.summary}"

To display the severity of a tracker issue when it is updated, you have to iterate over it as a collection property in tracker_item_updated_notification_email_body.vm:

#foreach($severity in $trackerItem.severities)

To display the full commit message in the email subject, remove the use of the textFormatter.abbreviate tool in scc_modification_committed_notification_email_subject.vm as:

CB Change Committed to [${}] ${} "${commit.message}"

#if(${commit.changeFiles.size()} == 1)
	(1 change)
	(${commit.changeFiles.size()} changes)

(+${diffStats.linesAdded} -${diffStats.linesRemoved})

Customizing the Email Sending

CodeBeamer runs a Groovy scripts to decide whether to send a notification email to an addressee. For each mail and for each addressee, it evaluates a script that must return a boolean return value:

  • TRUE: send the mail to the addressee
  • FALSE: skip this addressee

Groovy is a full-blown scripting language that integrates very well with Java, so you have unlimited possibilities with this and in most of the cases it requires only minimal programming skills. Our only limitation is that there is one script for each email type and you can't customize it for each user.
The default scripts that are shipped with CodeBeamer will allow sending any email to all addressee:

return true

The scripts can be modified on-the-fly, there is no need to restart the container (Tomcat).


To disable tracker item creation emails in certain projects or trackers, modify tracker_item_created_notification_script.groovy by adding the appropriate project IDs or tracker IDs to the lists:

// list of project IDs, tracker IDs and tracker item IDs
// that will be ignored when sending notification emails
def ignoredProjects = [-1, -2]
def ignoredTrackers = [-1, -2]
def ignoredTrackerItems = [-1, -2]

// reject if listed
if( in ignoredProjects || in ignoredTrackers || in ignoredTrackerItems) {
	return false

return true

To restrict tracker item update emails only to certain property changes, check the modifiedProperties collection in tracker_item_updated_notification_script.groovy. In this example, the mail will be sent only when status is changed to Closed:

for(modifiedProperty in modifiedProperties) {
  if(modifiedProperty.fieldName == "Status" && modifiedProperty.newValue == "Closed") {
    return true;

return false;

Adding images to Emails

Normally the images are removed from emails: they are replaced by a an image looks like .

This happens for security reasons and also to prevent broken images in the emails which may happen in the user who looks at the email does not have a permission to view the referenced image(s).

However if you want to include images into your emails and keep them in your custom email templates then your options are:

  • Embed your image into the HTML template using Data URI scheme, so these images will be kept in your emails. For example this HTML markup will render an red dot:
    <img src="data:image/png;base64,iVBORw0KGgoAAA
    5ErkJggg==" alt="Red dot" />
  • Or use a special keepImageInEmails CSS class in your HTML markup to mark the images should be kept in your email. In the next example the image "myImage.png" will be preserved in your email because it has this special CSS class:
    <img src="http://mysite/myimage.png" class="keepImageInEmails" />
The email clients -like Google's gmail web interface- may not display the images in data-uri or even external images. This can happen because the embedded images may either break the layout of the Gmail web-page and/or the images are sometimes have security implications: for example some pages may use small hidden images to track your action whether you have opened/viewed the email or not. So always test in your environment if the email works as designed !

Links: Turn images on or off in Gmail