]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
Ensure from is set for mail (resolves sendgrid smtp error)
authorMark Cooper <mark.c.cooper@outlook.com>
Tue, 6 Apr 2021 00:09:34 +0000 (17:09 -0700)
committerMark Cooper <mark.c.cooper@outlook.com>
Tue, 6 Apr 2021 00:26:55 +0000 (17:26 -0700)
services/common/src/main/java/org/collectionspace/services/common/EmailUtil.java

index 103154f21e4d841a48229c468358c5fc11995db9..29ecabdf0d49295098364e55b778694b17b18a4f 100644 (file)
@@ -8,6 +8,7 @@ import javax.mail.MessagingException;
 import javax.mail.Session;
 import javax.mail.Transport;
 import javax.mail.internet.MimeMessage;
+import javax.mail.internet.InternetAddress;
 
 import org.collectionspace.services.config.tenant.EmailConfig;
 
@@ -48,6 +49,7 @@ public class EmailUtil {
 
            try {
                    msg.setRecipients(Message.RecipientType.TO, recipient);
+                   msg.setFrom(new InternetAddress(props.getProperty("mail.from")));
                    msg.setSubject("JavaMail hello world example");
                    msg.setSentDate(new Date());
                    msg.setText("Hello, world!\n");
@@ -83,6 +85,7 @@ public class EmailUtil {
 
            try {
                    msg.setRecipients(Message.RecipientType.TO, recipients);
+                   msg.setFrom(new InternetAddress(emailConfig.getFrom()));
                    msg.setSubject(emailConfig.getPasswordResetConfig().getSubject());
                    msg.setSentDate(new Date());
                    msg.setText(message);