diff --git a/dspace-api/src/main/java/org/dspace/app/requestitem/RequestItemEmailNotifier.java b/dspace-api/src/main/java/org/dspace/app/requestitem/RequestItemEmailNotifier.java index 02054ee1a0..435fa0f9cc 100644 --- a/dspace-api/src/main/java/org/dspace/app/requestitem/RequestItemEmailNotifier.java +++ b/dspace-api/src/main/java/org/dspace/app/requestitem/RequestItemEmailNotifier.java @@ -154,9 +154,9 @@ public class RequestItemEmailNotifier { email.setContent("body", message); email.setSubject(subject); email.addRecipient(ri.getReqEmail()); - if (ri.isAccept_request()) { - // Attach bitstreams. - try { + // Attach bitstreams. + try { + if (ri.isAccept_request()) { if (ri.isAllfiles()) { Item item = ri.getItem(); List bundles = item.getBundles("ORIGINAL"); @@ -179,11 +179,19 @@ public class RequestItemEmailNotifier { bitstream.getFormat(context).getMIMEType()); } email.send(); - } catch (MessagingException | IOException | SQLException | AuthorizeException e) { - LOG.warn(LogHelper.getHeader(context, - "error_mailing_requestItem", e.getMessage())); - throw new IOException("Reply not sent: " + e.getMessage()); + } else { + boolean sendRejectEmail = configurationService + .getBooleanProperty("request.item.reject.email", true); + // Not all sites want the "refusal" to be sent back to the requester via + // email. However, by default, the rejection email is sent back. + if (sendRejectEmail) { + email.send(); + } } + } catch (MessagingException | IOException | SQLException | AuthorizeException e) { + LOG.warn(LogHelper.getHeader(context, + "error_mailing_requestItem", e.getMessage())); + throw new IOException("Reply not sent: " + e.getMessage()); } LOG.info(LogHelper.getHeader(context, "sent_attach_requestItem", "token={}"), ri.getToken()); diff --git a/dspace/config/dspace.cfg b/dspace/config/dspace.cfg index 8e532310c1..29c21325fc 100644 --- a/dspace/config/dspace.cfg +++ b/dspace/config/dspace.cfg @@ -1549,6 +1549,10 @@ log.report.dir = ${dspace.dir}/log request.item.type = all # Should all Request Copy emails go to the helpdesk instead of the item submitter? request.item.helpdesk.override = false +# Should a rejection of a copy request send an email back to the requester? +# Defaults to "true", which means a rejection email is sent back. +# Setting it to "false" results in a silent rejection. +request.item.reject.email = true #------------------------------------------------------------------# #------------------SUBMISSION CONFIGURATION------------------------#