diff --git a/repository/src/main/java/org/alfresco/repo/invitation/InvitationServiceImpl.java b/repository/src/main/java/org/alfresco/repo/invitation/InvitationServiceImpl.java index ea9aeb9a51..524461d524 100644 --- a/repository/src/main/java/org/alfresco/repo/invitation/InvitationServiceImpl.java +++ b/repository/src/main/java/org/alfresco/repo/invitation/InvitationServiceImpl.java @@ -1997,17 +1997,29 @@ public class InvitationServiceImpl implements InvitationService, NodeServicePoli private void sendInviteEmail(InviteSender inviteSender, List invitePropNames, String inviteId, String emailTemplateXpath, String emailSubjectKey, Map executionVariables) { - if (isSendEmails()) + // Do nothing if emails disabled. + if (isSendEmails() == false) + { + return; + } + + // send email to the invitee if possible - but don't fail the invitation if email cannot be sent + try { Map properties = makePropertiesFromContextVariables(executionVariables, invitePropNames); String packageRef = getPackageRef(executionVariables); properties.put(InviteNominatedSender.WF_PACKAGE, packageRef); - + properties.put(InviteNominatedSender.WF_INSTANCE_ID, inviteId); - + inviteSender.sendMail(emailTemplateXpath, emailSubjectKey, properties); } + catch (Exception e) + { + // Swallow exception + logger.error("unable to send invite email", e); + } }