pull/4353/head
Marcelo Schmidt 9 years ago
parent 506c64df97
commit b88f427ea5
No known key found for this signature in database
GPG Key ID: CA48C21A7B66097E
  1. 4
      packages/rocketchat-channel-settings-mail-messages/server/methods/mailMessages.coffee
  2. 1
      packages/rocketchat-i18n/i18n/en.i18n.json
  3. 8
      packages/rocketchat-lib/server/functions/saveUser.js
  4. 14
      packages/rocketchat-lib/server/methods/sendInvitationEmail.coffee
  5. 15
      packages/rocketchat-lib/server/methods/sendSMTPTestEmail.coffee

@ -23,7 +23,9 @@ Meteor.methods
emails.push user.emails[0].address
else
missing.push username
console.log emails
console.log 'Sending messages to e-mails: ', emails
for email in emails
unless rfcMailPatternWithName.test email.trim()
throw new Meteor.Error('error-invalid-email', "Invalid email #{email}", { method: 'mailMessages', email: email })

@ -384,6 +384,7 @@
"error-department-not-found" : "Department not found",
"error-duplicate-channel-name" : "A channel with name '__channel_name__' exists",
"error-email-domain-blacklisted" : "The email domain is blacklisted",
"error-email-send-failed" : "Error trying to send email: __message__",
"error-field-unavailable" : "<strong>__field__</strong> is already in use :(",
"error-file-too-large" : "File is too large",
"error-importer-not-defined" : "The importer was not defined correctly, it is missing the Import class.",

@ -110,7 +110,13 @@ RocketChat.saveUser = function(userId, userData) {
html: header + html + footer
};
Email.send(email);
Meteor.defer(function() {
try {
Email.send(email);
} catch (error) {
throw new Meteor.Error('error-email-send-failed', 'Error trying to send email: ' + error.message, { function: 'RocketChat.saveUser', message: error.message });
}
});
}
return _id;

@ -29,10 +29,14 @@ Meteor.methods
html = RocketChat.placeholders.replace(html, { email: email });
Email.send
to: email
from: RocketChat.settings.get 'From_Email'
subject: subject
html: header + html + footer
try
Email.send
to: email
from: RocketChat.settings.get 'From_Email'
subject: subject
html: header + html + footer
catch error
throw new Meteor.Error 'error-email-send-failed', 'Error trying to send email: ' + error.message, { method: 'sendInvitationEmail', message: error.message }
return validEmails

@ -12,13 +12,16 @@ Meteor.methods
header = RocketChat.placeholders.replace(RocketChat.settings.get('Email_Header') || '');
footer = RocketChat.placeholders.replace(RocketChat.settings.get('Email_Footer') || '');
Email.send
to: user.emails[0].address
from: RocketChat.settings.get('From_Email')
subject: "SMTP Test Email"
html: header + "<p>You have successfully sent an email</p>" + footer
console.log 'Sending test email to ' + user.emails[0].address
console.log 'Sending email to ' + user.emails[0].address
try
Email.send
to: user.emails[0].address
from: RocketChat.settings.get('From_Email')
subject: "SMTP Test Email"
html: header + "<p>You have successfully sent an email</p>" + footer
catch error
throw new Meteor.Error 'error-email-send-failed', 'Error trying to send email: ' + error.message, { method: 'sendSMTPTestEmail', message: error.message }
return {
message: "Your_mail_was_sent_to_s"

Loading…
Cancel
Save