Index: Jenkinsfile
===================================================================
--- Jenkinsfile	(revision 018fac462e3fa6838082850f460ecc8416e967f1)
+++ Jenkinsfile	(revision f2b977a645d9e52aa60db15b41b9f76312f7badb)
@@ -1,6 +1,6 @@
 
 //Configurations for email format
-def email_subject = '[$PROJECT_NAME git] - branch $GIT_BRANCH - Build # $BUILD_NUMBER - $BUILD_STATUS!'
-def email_body = '''This is an automated email from the Jenkins build machine. It was
+def email_subject_template = '[$PROJECT_NAME git] - branch $GIT_BRANCH - Build # $BUILD_NUMBER - $BUILD_STATUS!'
+def email_body_template = '''This is an automated email from the Jenkins build machine. It was
 generated because of a git hooks/post-receive script following
 a ref change was pushed to the repository containing
@@ -18,9 +18,20 @@
 
 node ('master'){
-  stage 'Build'
-  checkout scm //checkout the source code from source control
-  sh 'CC=gcc-4.9 CXX=g++-4.9 ./configure'
-  sh 'make -j 8'
-  //emailext body: email_body, subject: email_subject, to: ''
-  emailext body: '$DEFAULT_CONTENT', subject: '$DEFAULT_SUBJECT', to: 'tdelisle@uwaterloo.ca'
+	stage 'Build'
+	//clean the repo and checkout the source code
+	checkout scm
+
+	//configure the conpilation
+	sh 'CC=gcc-4.9 CXX=g++-4.9 ./configure'
+
+	//build
+	sh 'make -j 8'
+
+	//send email notification
+
+	def email_subject = TokenMacro.expand( build, listener, email_subject_template );
+	def email_body = TokenMacro.expand( build, listener, email_body_template );
+	def email_to = 'tdelisle@uwaterloo.ca'
+
+	emailext body: email_body, subject: email_subject, to: email_to
  }
