diff --git a/src/main/java/org/olat/core/util/mail/MailerWithTemplate.java b/src/main/java/org/olat/core/util/mail/MailerWithTemplate.java
index d1b08178015f78f2134e70bf376c4d57b7673707..8c8bc80222917882007e69c9a31ac7697fd1fd4b 100644
--- a/src/main/java/org/olat/core/util/mail/MailerWithTemplate.java
+++ b/src/main/java/org/olat/core/util/mail/MailerWithTemplate.java
@@ -164,7 +164,7 @@ public class MailerWithTemplate {
 		if (recipientsTO != null) {
 			for (Identity recipient : recipientsTO) {
 				// populate velocity context with variables
-				VelocityContext context = new VelocityContext();
+				VelocityContext context = getContext(template);
 				template.putVariablesInMailContext(context, recipient);
 				sendWithContext(context, mCtxt, metaId, recipient, template, sender, result);
 				if (!result.getFailedIdentites().contains(recipient)) {
@@ -177,7 +177,7 @@ public class MailerWithTemplate {
 				List<Identity> cc = new ArrayList<Identity>();
 				cc.add(recipient);
 				// populate velocity context with variables
-				VelocityContext context = new VelocityContext();
+				VelocityContext context = getContext(template);
 				template.putVariablesInMailContext(context, recipient);
 				sendWithContext(context, mCtxt, metaId, recipient, template, sender, result);
 			}
@@ -191,6 +191,13 @@ public class MailerWithTemplate {
 		return result;
 	}
 	
+	private VelocityContext getContext(MailTemplate template) {
+		if(template != null && template.getContext() != null) {
+			return new VelocityContext(template.getContext());
+		}
+		return new VelocityContext();
+	}
+	
 	/**
 	 * may return null, but then the result.getReturnCode != OK... so check the
 	 * result code.