This is an automated email from the ASF dual-hosted git repository.

dklco pushed a commit to branch dklco/form-framework
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-app-cms.git

commit 8ab3af5f25ddb1eaacf09cf249a850916b552c43
Author: Dan Klco <[email protected]>
AuthorDate: Sat Jul 27 00:44:23 2019 -0700

    Reordering the logging for the send email action to avoid erroring out
    before telling required info
---
 .../sling/cms/reference/forms/impl/actions/SendEmailAction.java  | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git 
a/reference/src/main/java/org/apache/sling/cms/reference/forms/impl/actions/SendEmailAction.java
 
b/reference/src/main/java/org/apache/sling/cms/reference/forms/impl/actions/SendEmailAction.java
index a66d457..5eb64ac 100644
--- 
a/reference/src/main/java/org/apache/sling/cms/reference/forms/impl/actions/SendEmailAction.java
+++ 
b/reference/src/main/java/org/apache/sling/cms/reference/forms/impl/actions/SendEmailAction.java
@@ -90,24 +90,25 @@ public class SendEmailAction implements JobConsumer, 
FormAction {
         log.trace("process");
 
         try {
+
+            log.debug("Configuring connection to {}:{} with username {}", 
config.hostName(), config.smtpPort(),
+                    config.username());
             Email email = new SimpleEmail();
             email.setHostName(config.hostName());
             email.setSmtpPort(config.smtpPort());
             email.setAuthenticator(new DefaultAuthenticator(config.username(), 
config.password()));
             email.setStartTLSEnabled(config.tlsEnabled());
-            log.debug("Configuring connection to {}:{} with username {}", 
config.hostName(), config.smtpPort(),
-                    config.username());
 
             String from = job.getProperty(FROM, String.class);
             String to = job.getProperty(TO, String.class);
             String subject = job.getProperty(SUBJECT, String.class);
             String message = job.getProperty(MESSAGE, String.class);
+            log.debug("Sending email from {} to {} with subject {}", from, to, 
subject);
 
             email.setFrom(from);
-            email.setSubject(job.getProperty(SUBJECT, String.class));
+            email.setSubject(subject);
             email.setMsg(message);
             email.addTo(to);
-            log.debug("Sending email from {} to {} with subject {}", from, to, 
subject);
 
             email.send();
         } catch (EmailException e) {

Reply via email to