Mail Templates
![](http://jazz.net/_images/myphoto/ef6615397d8c4f5730f6b85dc3cd0da4.jpg)
3 answers
![](http://jazz.net/_images/myphoto/ef6615397d8c4f5730f6b85dc3cd0da4.jpg)
Is there a way to create a customized .email template for use in more than a single project?
We would like to have several "default" versions of the same template, i.e. .email, .email1, etc. that can be used by any project.
Any ideas?
Thanks!
Jonas
Any ideas?
Hi Jonas,
I can't think of anything exactly like you want to do. You could open an enhancement request through the jazz.net site at the link below.
http://jazz.net/jazz08/web/projects/Rational%20Build%20Forge#action=com.ibm.team.workitem.newWorkItem
However, another more immediate solution that I can think of is to use the service layer API client. You'll have to modify some of the contents to fit your needs, but I think it could be a quicker solution than manually entering templates via the Web UI.
use strict;
use BuildForge::Services;
my $host = 'localhost';
my $user = 'root';
my $password = 'root';
my $projectName = 'P_1';
my $conn = new BuildForge::Services::Connection($host);
my $token = $conn->authUser($user, $password);
my $project = BuildForge::Services::DBO::Project->findByName($conn, $projectName);
die('Could not find project ' . $projectName) unless defined($project);
my $template = new BuildForge::Services::DBO::Template($conn);
$template->setType('step_email');
$template->setProjectUuid($project->getUuid());
$template = $template->create();
print "Created step_email template for " . $projectName . " (" . $project->getUuid() . ")" . "\n";
my $templateBody = new BuildForge::Services::DBO::TemplateBody($conn);
$templateBody->setTemplateUuid($template->getUuid());
$templateBody->setDescription('Step .email Message');
$templateBody->setFrom('buildforge@mycompany.com');
$templateBody->setSubject('${PROJECTNAME}:${TAG} of the project ${PROJECTNAME} at step ${STEPNAME} sent you this email.');
$templateBody->setBodyText('Job ${TAG} of the project ${PROJECTNAME} at step ${STEPNAME} sent you this email.');
$templateBody->setLocale('en_US');
$templateBody = $templateBody->create();
print "Created template body (" . $templateBody->getUuid() . ") for step_email template with uuid of " . $template->getUuid() . "\n";
$conn->logout();
$conn->close();
To invoke the script, you'll of course need Perl and have downloaded the Perl services layer client code. Then you can run:
perl -I"" MyFile.pl
Brent Ulbricht
Developer/Lead - RTC Build
![](http://jazz.net/_images/myphoto/ef6615397d8c4f5730f6b85dc3cd0da4.jpg)
Very nice. I like that approach! Thanks very much.
Jonas
Any ideas?
Hi Jonas,
I can't think of anything exactly like you want to do. You could open an enhancement request through the jazz.net site at the link below.
http://jazz.net/jazz08/web/projects/Rational%20Build%20Forge#action=com.ibm.team.workitem.newWorkItem
However, another more immediate solution that I can think of is to use the service layer API client. You'll have to modify some of the contents to fit your needs, but I think it could be a quicker solution than manually entering templates via the Web UI.
To invoke the script, you'll of course need Perl and have downloaded the Perl services layer client code. Then you can run:
perl -I"" MyFile.pl
Brent Ulbricht
Developer/Lead - RTC Build
Jonas
Is there a way to create a customized .email template for use in more than a single project?
We would like to have several "default" versions of the same template, i.e. .email, .email1, etc. that can be used by any project.
Any ideas?
Thanks!
Jonas
Any ideas?
Hi Jonas,
I can't think of anything exactly like you want to do. You could open an enhancement request through the jazz.net site at the link below.
http://jazz.net/jazz08/web/projects/Rational%20Build%20Forge#action=com.ibm.team.workitem.newWorkItem
However, another more immediate solution that I can think of is to use the service layer API client. You'll have to modify some of the contents to fit your needs, but I think it could be a quicker solution than manually entering templates via the Web UI.
use strict;
use BuildForge::Services;
my $host = 'localhost';
my $user = 'root';
my $password = 'root';
my $projectName = 'P_1';
my $conn = new BuildForge::Services::Connection($host);
my $token = $conn->authUser($user, $password);
my $project = BuildForge::Services::DBO::Project->findByName($conn, $projectName);
die('Could not find project ' . $projectName) unless defined($project);
my $template = new BuildForge::Services::DBO::Template($conn);
$template->setType('step_email');
$template->setProjectUuid($project->getUuid());
$template = $template->create();
print "Created step_email template for " . $projectName . " (" . $project->getUuid() . ")" . "\n";
my $templateBody = new BuildForge::Services::DBO::TemplateBody($conn);
$templateBody->setTemplateUuid($template->getUuid());
$templateBody->setDescription('Step .email Message');
$templateBody->setFrom('buildforge@mycompany.com');
$templateBody->setSubject('${PROJECTNAME}:${TAG} of the project ${PROJECTNAME} at step ${STEPNAME} sent you this email.');
$templateBody->setBodyText('Job ${TAG} of the project ${PROJECTNAME} at step ${STEPNAME} sent you this email.');
$templateBody->setLocale('en_US');
$templateBody = $templateBody->create();
print "Created template body (" . $templateBody->getUuid() . ") for step_email template with uuid of " . $template->getUuid() . "\n";
$conn->logout();
$conn->close();
To invoke the script, you'll of course need Perl and have downloaded the Perl services layer client code. Then you can run:
perl -I"" MyFile.pl
Brent Ulbricht
Developer/Lead - RTC Build