Skip to content
Snippets Groups Projects
Unverified Commit eb3af89b authored by graywolf336's avatar graywolf336
Browse files

Fix an exception occuring in the smarsh connector when a user didn't have an...

Fix an exception occuring in the smarsh connector when a user didn't have an email, adds a setting to configure the default email for missing emails
parent 4ef599eb
No related branches found
No related tags found
No related merge requests found
......@@ -1084,6 +1084,8 @@
"Smarsh_Email_Description": "Smarsh Email Address to send the .eml file to.",
"Smarsh_Interval": "Smarsh Interval",
"Smarsh_Interval_Description": "The amount of time to wait before sending the chats (needs 'From Email' filled in under Email -> SMTP).",
"Smarsh_MissingEmail_Email": "Missing Email",
"Smarsh_MissingEmail_Email_Description": "The email to show for a user account when their email address is missing, generally happens with bot accounts.",
"Smileys_and_People" : "Smileys & People",
"SMS_Enabled" : "SMS Enabled",
"SMTP" : "SMTP",
......
......@@ -50,7 +50,13 @@ RocketChat.smarsh.generateEml = () => {
if (data.users.indexOf(sender._id) === -1) {
data.users.push(sender._id);
}
rows.push(`${sender.name} <${sender.emails[0].address}>`);
//Get the user's email, can be nothing if it is an unconfigured bot account (like rocket.cat)
if (sender.emails && sender.emails[0] && sender.emails[0].address) {
rows.push(`${sender.name} <${sender.emails[0].address}>`);
} else {
rows.push(`${sender.name} <${RocketChat.settings.get('Smarsh_MissingEmail_Email')}>`);
}
rows.push(closetd);
//The message
......
......@@ -15,6 +15,11 @@ RocketChat.settings.addGroup('Smarsh', function addSettings() {
i18nLabel: 'Smarsh_Email',
placeholder: 'email@domain.com'
});
this.add('Smarsh_MissingEmail_Email', 'no-email@example.com', {
type: 'string',
i18nLabel: 'Smarsh_MissingEmail_Email',
placeholder: 'no-email@example.com'
});
this.add('Smarsh_Interval', 'every_30_minutes', {
type: 'select',
values: [{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment