diff --git a/client/views/admin/admin.html b/client/views/admin/admin.html
index e08a30a2a24..868662ba7e7 100644
--- a/client/views/admin/admin.html
+++ b/client/views/admin/admin.html
@@ -55,7 +55,7 @@
{{/if}}
{{#if description}}
- {{description}}
+ {{{description}}}
{{/if}}
diff --git a/i18n/en.i18n.json b/i18n/en.i18n.json
index e8451784080..3c39e0ccab8 100644
--- a/i18n/en.i18n.json
+++ b/i18n/en.i18n.json
@@ -45,6 +45,8 @@
"Accounts_OAuth_Twitter_secret" : "Twitter Secret",
"Accounts_RegistrationRequired" : "Registration Required",
"Accounts_RequireNameForSignUp" : "Require name for signup",
+ "Accounts_Enrollment_Email": "Enrollment E-mail",
+ "Accounts_Enrollment_Email_Description": "You may use [name], [fname], [lname] for the user's full name, first name or last name, respectively.
You may use [email] for the user's e-mail.",
"Activate" : "Activate",
"Add_custom_oauth" : "Add custom oauth",
"Add_Members" : "Add Members",
diff --git a/packages/rocketchat-lib/server/functions/setUsername.coffee b/packages/rocketchat-lib/server/functions/setUsername.coffee
index 9497f705f71..2e4d5982937 100644
--- a/packages/rocketchat-lib/server/functions/setUsername.coffee
+++ b/packages/rocketchat-lib/server/functions/setUsername.coffee
@@ -16,6 +16,10 @@ RocketChat.setUsername = (user, username) ->
previousUsername = user.username
+ # If first time setting username, send Enrollment Email
+ if not previousUsername and RocketChat.settings.get 'Accounts_Enrollment_Email'
+ Accounts.sendEnrollmentEmail(user._id)
+
# Username is available; if coming from old username, update all references
if previousUsername
RocketChat.models.Messages.updateAllUsernamesByUserId user._id, username
diff --git a/packages/rocketchat-lib/settings/server/startup.coffee b/packages/rocketchat-lib/settings/server/startup.coffee
index e32e50c37aa..c6dd4baa38c 100644
--- a/packages/rocketchat-lib/settings/server/startup.coffee
+++ b/packages/rocketchat-lib/settings/server/startup.coffee
@@ -68,6 +68,7 @@ RocketChat.settings.add 'From_Email', '', { type: 'string', group: 'SMTP', place
RocketChat.settings.add 'Invitation_Subject', 'You have been invited to Rocket.Chat', { type: 'string', group: 'SMTP', section: 'Invitation' }
RocketChat.settings.add 'Invitation_HTML', 'You have been invited to Rocket.Chat
Go to ' + __meteor_runtime_config__?.ROOT_URL + ' and try the best open source chat solution available today!
', { type: 'string', multiline: true, group: 'SMTP', section: 'Invitation' }
+RocketChat.settings.add 'Accounts_Enrollment_Email', '', { type: 'string', multiline: true, group: 'SMTP', section: 'Invitation' }
RocketChat.settings.addGroup 'Message'
RocketChat.settings.add 'Message_AllowEditing', true, { type: 'boolean', group: 'Message', public: true }
diff --git a/server/lib/accounts.coffee b/server/lib/accounts.coffee
index 23047777530..eb0878f6cfc 100644
--- a/server/lib/accounts.coffee
+++ b/server/lib/accounts.coffee
@@ -27,6 +27,17 @@ Accounts.emailTemplates.resetPassword.text = (user, url) ->
url = url.replace Meteor.absoluteUrl(), Meteor.absoluteUrl() + 'login/'
verifyEmailText user, url
+if RocketChat.settings.get 'Accounts_Enrollment_Email'
+ Accounts.emailTemplates.enrollAccount.text = (user, url) ->
+ text = RocketChat.settings.get 'Accounts_Enrollment_Email'
+
+ text = text.replace /\[name\]/g, user.name or ''
+ text = text.replace /\[fname\]/g, _.strLeft(user.name, ' ') or ''
+ text = text.replace /\[lname\]/g, _.strRightBack(user.name, ' ') or ''
+ text = text.replace /\[email\]/g, user.emails?[0]?.address or ''
+
+ return text
+
Accounts.onCreateUser (options, user) ->
# console.log 'onCreateUser ->',JSON.stringify arguments, null, ' '
# console.log 'options ->',JSON.stringify options, null, ' '