Skip to content

Commit 537ad3f

Browse files
danielcorreia96sergiofbsilva
authored andcommitted
IOException while sending message FMSG-49 #resolve (#93)
1 parent 1e1a0ea commit 537ad3f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

email-dispatch/src/main/java/org/fenixedu/messaging/emaildispatch/domain/MimeMessageHandler.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@
3737
import org.fenixedu.messaging.emaildispatch.EmailDispatchConfiguration.ConfigurationProperties;
3838
import org.joda.time.DateTime;
3939

40+
import com.google.common.base.Strings;
4041
import com.google.common.collect.Lists;
4142

42-
import org.springframework.util.StringUtils;
4343
import pt.ist.fenixframework.Atomic;
4444
import pt.ist.fenixframework.Atomic.TxMode;
4545

@@ -113,7 +113,7 @@ protected void updateMessageID() throws MessagingException {
113113
mimeMessage.setSubject(getContent(message.getSubject(), locale));
114114

115115
final String replyTo = message.getReplyTo();
116-
if (StringUtils.hasText(replyTo)) {
116+
if (!Strings.isNullOrEmpty(replyTo)) {
117117
Address[] replyTos = { new InternetAddress(replyTo) };
118118
mimeMessage.setReplyTo(replyTos);
119119
}
@@ -126,14 +126,14 @@ protected void updateMessageID() throws MessagingException {
126126

127127
// Should be ordered "plainest to richest" (first: text/plain | second: text/html) to display properly in email clients
128128
final String textBody = getContent(message.getTextBody(), locale);
129-
if (StringUtils.hasText(textBody)) {
129+
if (!Strings.isNullOrEmpty(textBody)) {
130130
final BodyPart bodyPart = new MimeBodyPart();
131-
bodyPart.setText(textBody);
131+
bodyPart.setContent(textBody, "text/plain; charset=utf-8");
132132
htmlAndTextMultipart.addBodyPart(bodyPart);
133133
}
134134

135135
final String htmlBody = getContent(message.getHtmlBody(), locale);
136-
if (StringUtils.hasText(htmlBody)) {
136+
if (!Strings.isNullOrEmpty(htmlBody)) {
137137
final BodyPart bodyPart = new MimeBodyPart();
138138
bodyPart.setContent(htmlBody, "text/html; charset=utf-8");
139139
htmlAndTextMultipart.addBodyPart(bodyPart);

0 commit comments

Comments
 (0)