Skip to content

Commit 65e2a0f

Browse files
tobiasakeemichaf
authored andcommitted
Added missing Mail and SMTP settings in application properties file. (#46)
* Added missing Mail and SMTP settings in application properties file. * Fixed sendMail issue when Subscription condition matched and never executed sendmail functionality and some null pointer exeception around sendMail functionality. * Changed Notification if case to else if when checking if type is MAIL.
1 parent c489bc7 commit 65e2a0f

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

src/main/java/com/ericsson/ei/subscriptionhandler/InformSubscription.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,14 @@ public void informSubscriber(String aggregatedObject, JsonNode subscriptionJson)
115115
} else
116116
log.info("Notification saved in the database");
117117
}
118-
if (notificationType.equals("EMAIL")) {
119-
log.info("Notification through EMAIL");
120-
sendMail.sendMail(notificationMeta, aggregatedObject);
121118

122-
}
123119
}
124120
}
121+
else if (notificationType.trim().equals("MAIL")) {
122+
log.info("Notification through EMAIL");
123+
sendMail.sendMail(notificationMeta, aggregatedObject);
124+
125+
}
125126
}
126127

127128
/**

src/main/java/com/ericsson/ei/subscriptionhandler/SendMail.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import lombok.Getter;
2222
import org.slf4j.Logger;
2323
import org.slf4j.LoggerFactory;
24+
import org.springframework.beans.factory.annotation.Autowired;
2425
import org.springframework.beans.factory.annotation.Value;
2526
import org.springframework.mail.MailSender;
2627
import org.springframework.mail.SimpleMailMessage;
@@ -46,7 +47,8 @@ public class SendMail {
4647
@Getter
4748
@Value("${email.subject}")
4849
private String subject;
49-
50+
51+
@Autowired
5052
private MailSender mailSender;
5153

5254
public void setMailSender(MailSender mailSender) {

src/main/resources/application.properties

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,11 @@ email.subject: Email Subscription Notification
5050
notification.failAttempt: 3
5151
notification.ttl.value: 600
5252

53+
spring.mail.host:
54+
spring.mail.port:
55+
#spring.mail.username:
56+
#spring.mail.password:
57+
spring.mail.properties.mail.smtp.auth: false
58+
#spring.mail.properties.mail.smtp.starttls.enable: false
59+
5360
er.url: http://localhost:8080/search/

0 commit comments

Comments
 (0)