diff --git a/packages/rocketchat-lib/i18n/en.i18n.json b/packages/rocketchat-lib/i18n/en.i18n.json
index 01986c9757b..2b6a1e019c4 100644
--- a/packages/rocketchat-lib/i18n/en.i18n.json
+++ b/packages/rocketchat-lib/i18n/en.i18n.json
@@ -30,7 +30,7 @@
"Accounts_EmailVerification" : "Email Verification",
"Accounts_EmailVerification_Description" : "Make sure you have correct SMTP settings to use this feature",
"Accounts_Enrollment_Email" : "Enrollment Email",
- "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 email.",
+ "Accounts_Enrollment_Email_Description" : "You may use the following placeholders:
Go to [Site_URL] and try the best open source chat solution available today!
", "Invitation_Subject" : "Invitation Subject", "Invite_user_to_join_channel" : "Invite one user to join this channel", "Invite_Users" : "Invite Users", @@ -750,6 +753,7 @@ "Please_wait_while_OTR_is_being_established" : "Please wait while OTR is being established", "Please_wait_while_your_account_is_being_deleted" : "Please wait while your account is being deleted...", "Please_wait_while_your_profile_is_being_saved" : "Please wait while your profile is being saved...", + "Port" : "Port", "Post_as" : "Post as", "Post_to_Channel" : "Post to Channel", "Post_to_s_as_s" : "Post to %s as %s", diff --git a/packages/rocketchat-lib/server/startup/settings.coffee b/packages/rocketchat-lib/server/startup/settings.coffee index 1175bb09198..be5f98e389d 100644 --- a/packages/rocketchat-lib/server/startup/settings.coffee +++ b/packages/rocketchat-lib/server/startup/settings.coffee @@ -104,22 +104,26 @@ RocketChat.settings.addGroup 'General', -> @add 'Desktop_Notifications_Duration', 0, { type: 'int', public: true, i18nDescription: 'Desktop_Notification_Durations_Description' } -RocketChat.settings.addGroup 'SMTP', -> - @add 'SMTP_Host', '', { type: 'string', env: true } - @add 'SMTP_Port', '', { type: 'string', env: true } - @add 'SMTP_Username', '', { type: 'string', env: true } - @add 'SMTP_Password', '', { type: 'password', env: true } - @add 'From_Email', '', { type: 'string', placeholder: 'email@domain' } - @add 'SMTP_Test_Button', 'sendSMTPTestEmail', { type: 'action', actionText: 'Send_a_test_mail_to_my_user' } +RocketChat.settings.addGroup 'Email', -> + @section 'SMTP', -> + @add 'SMTP_Host', '', { type: 'string', env: true, i18nLabel: 'Host' } + @add 'SMTP_Port', '', { type: 'string', env: true, i18nLabel: 'Port' } + @add 'SMTP_Username', '', { type: 'string', env: true, i18nLabel: 'Username' } + @add 'SMTP_Password', '', { type: 'password', env: true, i18nLabel: 'Password' } + @add 'From_Email', '', { type: 'string', placeholder: 'email@domain' } + @add 'SMTP_Test_Button', 'sendSMTPTestEmail', { type: 'action', actionText: 'Send_a_test_mail_to_my_user' } @section 'Invitation', -> - @add 'Invitation_Subject', 'You have been invited to Rocket.Chat', { type: 'string' } - @add 'Invitation_HTML', 'Go to ' + __meteor_runtime_config__?.ROOT_URL + ' and try the best open source chat solution available today!
', { type: 'string', multiline: true } - @add 'Accounts_Enrollment_Email', '', { type: 'string', multiline: true } + @add 'Invitation_Subject', 'You have been invited to Rocket.Chat', { type: 'string', i18nLabel: 'Subject' } + @add 'Invitation_HTML', '', { type: 'code', code: 'text/html', multiline: true, i18nLabel: 'Body', i18nDescription: 'Invitation_HTML_Description' } + + @section 'Registration', -> + @add 'Accounts_Enrollment_Email_Subject', '', { type: 'string', i18nLabel: 'Subject' } + @add 'Accounts_Enrollment_Email', '', { type: 'code', code: 'text/html', multiline: true, i18nLabel: 'Body', i18nDescription: 'Accounts_Enrollment_Email_Description' } @section 'Registration via Admin', -> - @add 'Accounts_UserAddedEmail', '', { type: 'string', multiline: true, i18nLabel: 'Email', i18nDescription: 'Accounts_UserAddedEmail_Description' } @add 'Accounts_UserAddedEmailSubject', '', { type: 'string', i18nLabel: "Subject" } + @add 'Accounts_UserAddedEmail', '', { type: 'code', code: 'text/html', multiline: true, i18nLabel: 'Body', i18nDescription: 'Accounts_UserAddedEmail_Description' } RocketChat.settings.addGroup 'Message', -> diff --git a/server/lib/accounts.coffee b/server/lib/accounts.coffee index 56fae1444f9..4e7e4362d78 100644 --- a/server/lib/accounts.coffee +++ b/server/lib/accounts.coffee @@ -30,15 +30,19 @@ Accounts.emailTemplates.resetPassword.text = (user, url) -> url = url.replace /\/#\//, '/' resetPasswordText user, url +if RocketChat.settings.get 'Accounts_Enrollment_Email_Subject' + Accounts.emailTemplates.enrollAccount.subject = (user) -> + return RocketChat.settings.get 'Accounts_Enrollment_Email_Subject' + 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 '' - + text = text.replace /\[Site_Name\]/g, RocketChat.settings.get("Site_Name") or '' + text = text.replace /\[Site_URL\]/g, RocketChat.settings.get("Site_Url") or '' return text Accounts.onCreateUser (options, user) ->