Author: ilgrosso
Date: Mon Sep 15 08:20:52 2014
New Revision: 1624962
URL: http://svn.apache.org/r1624962
Log:
[SYNCOPE-547] Merge and adapt from 1_1_X
Modified:
syncope/branches/1_2_X/core/src/main/java/org/apache/syncope/core/notification/NotificationJob.java
Modified:
syncope/branches/1_2_X/core/src/main/java/org/apache/syncope/core/notification/NotificationJob.java
URL:
http://svn.apache.org/viewvc/syncope/branches/1_2_X/core/src/main/java/org/apache/syncope/core/notification/NotificationJob.java?rev=1624962&r1=1624961&r2=1624962&view=diff
==============================================================================
---
syncope/branches/1_2_X/core/src/main/java/org/apache/syncope/core/notification/NotificationJob.java
(original)
+++
syncope/branches/1_2_X/core/src/main/java/org/apache/syncope/core/notification/NotificationJob.java
Mon Sep 15 08:20:52 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) {