3737import org .fenixedu .messaging .emaildispatch .EmailDispatchConfiguration .ConfigurationProperties ;
3838import org .joda .time .DateTime ;
3939
40+ import com .google .common .base .Strings ;
4041import com .google .common .collect .Lists ;
4142
42- import org .springframework .util .StringUtils ;
4343import pt .ist .fenixframework .Atomic ;
4444import 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