commit 21c7a15aed8412c27ea974e1168e45456b913cd2
parent d63eb8426caed05ed258dbaa2889318c968004e0
Author: Kebigon <git@kebigon.xyz>
Date: Sun, 8 Mar 2020 16:51:18 +0900
Add possibility to use BCC to send notifications without disclosing all destination email addresses
Diffstat:
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/main/java/xyz/kebigon/housesearch/HouseSearchApplication.java b/src/main/java/xyz/kebigon/housesearch/HouseSearchApplication.java
@@ -71,7 +71,6 @@ public class HouseSearchApplication
postings.forEach(sentPostings::add);
log.info("Email notification sent, terminating");
-
}
finally
{
diff --git a/src/main/java/xyz/kebigon/housesearch/mail/EmailSender.java b/src/main/java/xyz/kebigon/housesearch/mail/EmailSender.java
@@ -60,6 +60,10 @@ public class EmailSender
for (final String address : mailSession.getProperty("housesearch.mail.to").split(","))
email.addTo(address.trim());
+ email.setFrom(mailSession.getProperty("housesearch.mail.bcc").trim());
+ for (final String address : mailSession.getProperty("housesearch.mail.bcc").split(","))
+ email.addBcc(address.trim());
+
email.send();
}
diff --git a/src/main/packaged-resources/cfg/mail.cfg b/src/main/packaged-resources/cfg/mail.cfg
@@ -7,4 +7,5 @@ mail.smtp.user=
mail.smtp.password=
housesearch.mail.from=
-housesearch.mail.to=
-\ No newline at end of file
+housesearch.mail.to=
+housesearch.mail.bcc=
+\ No newline at end of file