Skip to content

Commit

Permalink
no welcome email for user received invitation email
Browse files Browse the repository at this point in the history
  • Loading branch information
tima101 committed Jun 15, 2018
1 parent 1a608c8 commit 6c5b53c
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions api/server/models/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,15 +209,17 @@ class UserClass extends mongoose.Model {
userName: displayName,
});

try {
await sendEmail({
from: `Kelly from async-await.com <${process.env.EMAIL_SUPPORT_FROM_ADDRESS}>`,
to: [email],
subject: template.subject,
body: template.message,
});
} catch (err) {
logger.error('Email sending error:', err);
if ((await Invitation.find({ email: email }).count()) === 0) {
try {
await sendEmail({
from: `Kelly from async-await.com <${process.env.EMAIL_SUPPORT_FROM_ADDRESS}>`,
to: [email],
subject: template.subject,
body: template.message,
});
} catch (err) {
logger.error('Email sending error:', err);
}
}

try {
Expand Down

0 comments on commit 6c5b53c

Please sign in to comment.