Skip to content

Commit

Permalink
Explicitly set recipients and from addresses on emails
Browse files Browse the repository at this point in the history
  • Loading branch information
maxwellpettit committed Feb 20, 2018
1 parent 756f837 commit 5308ae2
Showing 1 changed file with 3 additions and 1 deletion.
Expand Up @@ -30,6 +30,7 @@
import javax.mail.NoSuchProviderException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;

import org.jumpmind.properties.TypedProperties;
Expand Down Expand Up @@ -101,9 +102,10 @@ protected String sendEmail(String subject, String text, String recipients, Prope
try {
MimeMessage message = new MimeMessage(session);
message.setSentDate(new Date());
message.setRecipients(RecipientType.BCC, recipients);
message.setRecipients(RecipientType.TO, recipients);
message.setSubject(subject);
message.setText(text);
message.setFrom(new InternetAddress(prop.getProperty(JAVAMAIL_FROM)));
try {
transport.sendMessage(message, message.getAllRecipients());
} catch (MessagingException e) {
Expand Down

0 comments on commit 5308ae2

Please sign in to comment.