diff --git a/config/alfresco/messages/email-service.properties b/config/alfresco/messages/email-service.properties index 326b7a7fe1..95003ec12d 100644 --- a/config/alfresco/messages/email-service.properties +++ b/config/alfresco/messages/email-service.properties @@ -25,3 +25,7 @@ email.server.err.failed_to_read_content_stream=Failed to read the message part c email.server.err.incorrect_message_part=Incorrect message part: {0} email.outbound.err.send.failed=Failed to send email to: {0} cause {1} + +email.outbound.err.test.no.to=Unable to send test message 'testMessageTo' is empty +email.outbound.err.test.no.subject=Unable to send test message 'subject' is empty +email.outbound.err.test.no.text=Unable to send test message 'text' is empty diff --git a/source/java/org/alfresco/repo/action/executer/MailActionExecuter.java b/source/java/org/alfresco/repo/action/executer/MailActionExecuter.java index 8effd3a334..18c556c5ad 100644 --- a/source/java/org/alfresco/repo/action/executer/MailActionExecuter.java +++ b/source/java/org/alfresco/repo/action/executer/MailActionExecuter.java @@ -271,6 +271,18 @@ public class MailActionExecuter extends ActionExecuterAbstractBase */ public boolean sendTestMessage() { + if(testMessageTo == null || testMessageTo.length() == 0) + { + throw new AlfrescoRuntimeException("email.outbound.err.test.no.to"); + } + if(testMessageSubject == null || testMessageSubject.length() == 0) + { + throw new AlfrescoRuntimeException("email.outbound.err.test.no.subject"); + } + if(testMessageText == null || testMessageText.length() == 0) + { + throw new AlfrescoRuntimeException("email.outbound.err.test.no.text"); + } Map params = new HashMap(); params.put(PARAM_TO, testMessageTo); params.put(PARAM_SUBJECT, testMessageSubject); @@ -314,7 +326,7 @@ public class MailActionExecuter extends ActionExecuterAbstractBase numberFailedSends.set(0); super.init(); - if (sendTestMessage) + if (sendTestMessage && testMessageTo != null) { Map params = new HashMap(); params.put(PARAM_TO, testMessageTo);