Author: ilgrosso
Date: Mon Sep 15 08:21:44 2014
New Revision: 1624963

URL: http://svn.apache.org/r1624963
Log:
[SYNCOPE-547] Merge from 1_2_X

Modified:
    syncope/trunk/   (props changed)
    
syncope/trunk/core/src/main/java/org/apache/syncope/core/notification/NotificationJob.java

Propchange: syncope/trunk/
------------------------------------------------------------------------------
  Merged /syncope/branches/1_2_X:r1624480-1624962

Modified: 
syncope/trunk/core/src/main/java/org/apache/syncope/core/notification/NotificationJob.java
URL: 
http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/notification/NotificationJob.java?rev=1624963&r1=1624962&r2=1624963&view=diff
==============================================================================
--- 
syncope/trunk/core/src/main/java/org/apache/syncope/core/notification/NotificationJob.java
 (original)
+++ 
syncope/trunk/core/src/main/java/org/apache/syncope/core/notification/NotificationJob.java
 Mon Sep 15 08:21:44 2014
@@ -19,6 +19,7 @@
 package org.apache.syncope.core.notification;
 
 import java.util.Date;
+import java.util.Properties;
 
 import javax.mail.internet.MimeMessage;
 import org.apache.commons.lang3.StringUtils;
@@ -39,6 +40,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.mail.javamail.JavaMailSender;
+import org.springframework.mail.javamail.JavaMailSenderImpl;
 import org.springframework.mail.javamail.MimeMessageHelper;
 
 /**
@@ -93,6 +95,14 @@ public class NotificationJob implements 
             LOG.error("Invalid maximum number of retries, retries disabled", 
e);
             maxRetries = 0;
         }
+
+        if (mailSender instanceof JavaMailSenderImpl
+                && StringUtils.isNotBlank(((JavaMailSenderImpl) 
mailSender).getUsername())) {
+
+            Properties javaMailProperties = new Properties();
+            javaMailProperties.setProperty("mail.smtp.auth", "true");
+            ((JavaMailSenderImpl) 
mailSender).setJavaMailProperties(javaMailProperties);
+        }
     }
 
     public TaskExec executeSingle(final NotificationTask task) {


Reply via email to