Return-Path: X-Original-To: apmail-commons-notifications-archive@minotaur.apache.org Delivered-To: apmail-commons-notifications-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B07AC17844 for ; Sat, 23 May 2015 06:51:05 +0000 (UTC) Received: (qmail 89276 invoked by uid 500); 23 May 2015 06:51:05 -0000 Delivered-To: apmail-commons-notifications-archive@commons.apache.org Received: (qmail 89233 invoked by uid 500); 23 May 2015 06:51:05 -0000 Mailing-List: contact notifications-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list notifications@commons.apache.org Received: (qmail 88950 invoked by uid 99); 23 May 2015 06:51:05 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 23 May 2015 06:51:05 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id 4857BAC0AF8 for ; Sat, 23 May 2015 06:51:05 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r952406 [39/42] - in /websites/production/commons/content/proper/commons-email: ./ apidocs/ apidocs/org/apache/commons/mail/ apidocs/org/apache/commons/mail/class-use/ apidocs/org/apache/commons/mail/resolver/ apidocs/org/apache/commons/mai... Date: Sat, 23 May 2015 06:51:00 -0000 To: notifications@commons.apache.org From: tn@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150523065105.4857BAC0AF8@hades.apache.org> Modified: websites/production/commons/content/proper/commons-email/xref/org/apache/commons/mail/HtmlEmail.html ============================================================================== --- websites/production/commons/content/proper/commons-email/xref/org/apache/commons/mail/HtmlEmail.html (original) +++ websites/production/commons/content/proper/commons-email/xref/org/apache/commons/mail/HtmlEmail.html Sat May 23 06:50:57 2015 @@ -88,7 +88,7 @@ 80 * method defined on the <code>DataSource</code>s to make the determination. 81 * 82 * @since 1.0 -83 * @version $Id: HtmlEmail.java 1606709 2014-06-30 12:26:06Z ggregory $ +83 * @version $Id: HtmlEmail.java 1647983 2014-12-26 14:25:27Z tn $ 84 */ 85 public class HtmlEmail extends MultiPartEmail 86 { @@ -282,423 +282,448 @@ 274 { 275 return ii.getCid(); 276 } -277 else -278 { -279 throw new EmailException("embedded name '" + name -280 + "' is already bound to URL " + urlDataSource.getURL() -281 + "; existing names cannot be rebound"); -282 } -283 } -284 -285 // verify that the URL is valid -286 InputStream is = null; -287 try -288 { -289 is = url.openStream(); -290 } -291 catch (final IOException e) -292 { -293 throw new EmailException("Invalid URL", e); -294 } -295 finally -296 { -297 try -298 { -299 if (is != null) -300 { -301 is.close(); -302 } -303 } -304 catch (final IOException ioe) // NOPMD -305 { /* sigh */ } -306 } +277 throw new EmailException("embedded name '" + name +278 + "' is already bound to URL " + urlDataSource.getURL() +279 + "; existing names cannot be rebound"); +280 } +281 +282 // verify that the URL is valid +283 InputStream is = null; +284 try +285 { +286 is = url.openStream(); +287 } +288 catch (final IOException e) +289 { +290 throw new EmailException("Invalid URL", e); +291 } +292 finally +293 { +294 try +295 { +296 if (is != null) +297 { +298 is.close(); +299 } +300 } +301 catch (final IOException ioe) // NOPMD +302 { /* sigh */ } +303 } +304 +305 return embed(new URLDataSource(url), name); +306 } 307 -308 return embed(new URLDataSource(url), name); -309 } -310 -311 /** -312 * Embeds a file in the HTML. This implementation delegates to -313 * {@link #embed(File, String)}. -314 * -315 * @param file The <code>File</code> object to embed -316 * @return A String with the Content-ID of the file. -317 * @throws EmailException when the supplied <code>File</code> cannot be -318 * used; also see {@link javax.mail.internet.MimeBodyPart} for definitions -319 * -320 * @see #embed(File, String) -321 * @since 1.1 -322 */ -323 public String embed(final File file) throws EmailException -324 { -325 final String cid = EmailUtils.randomAlphabetic(HtmlEmail.CID_LENGTH).toLowerCase(Locale.ENGLISH); -326 return embed(file, cid); -327 } -328 -329 /** -330 * Embeds a file in the HTML. -331 * -332 * <p>This method embeds a file located by an URL into -333 * the mail body. It allows, for instance, to add inline images -334 * to the email. Inline files may be referenced with a -335 * <code>cid:xxxxxx</code> URL, where xxxxxx is the Content-ID -336 * returned by the embed function. Files are bound to their names, which is -337 * the value returned by {@link java.io.File#getName()}. If the same file -338 * is embedded multiple times, the same CID is guaranteed to be returned. -339 * -340 * <p>While functionally the same as passing <code>FileDataSource</code> to -341 * {@link #embed(DataSource, String, String)}, this method attempts -342 * to validate the file before embedding it in the message and will throw -343 * <code>EmailException</code> if the validation fails. In this case, the -344 * <code>HtmlEmail</code> object will not be changed. -345 * -346 * @param file The <code>File</code> to embed -347 * @param cid the Content-ID to use for the embedded <code>File</code> -348 * @return A String with the Content-ID of the file. -349 * @throws EmailException when the supplied <code>File</code> cannot be used -350 * or if the file has already been embedded; -351 * also see {@link javax.mail.internet.MimeBodyPart} for definitions -352 * @since 1.1 -353 */ -354 public String embed(final File file, final String cid) throws EmailException -355 { -356 if (EmailUtils.isEmpty(file.getName())) -357 { -358 throw new EmailException("file name cannot be null or empty"); -359 } -360 -361 // verify that the File can provide a canonical path -362 String filePath = null; -363 try -364 { -365 filePath = file.getCanonicalPath(); -366 } -367 catch (final IOException ioe) -368 { -369 throw new EmailException("couldn't get canonical path for " -370 + file.getName(), ioe); -371 } -372 -373 // check if a FileDataSource for this name has already been attached; -374 // if so, return the cached CID value. -375 if (inlineEmbeds.containsKey(file.getName())) -376 { -377 final InlineImage ii = inlineEmbeds.get(file.getName()); -378 final FileDataSource fileDataSource = (FileDataSource) ii.getDataSource(); -379 // make sure the supplied file has the same canonical path -380 // as the one already associated with this name. -381 String existingFilePath = null; -382 try -383 { -384 existingFilePath = fileDataSource.getFile().getCanonicalPath(); -385 } -386 catch (final IOException ioe) -387 { -388 throw new EmailException("couldn't get canonical path for file " -389 + fileDataSource.getFile().getName() -390 + "which has already been embedded", ioe); -391 } -392 if (filePath.equals(existingFilePath)) -393 { -394 return ii.getCid(); -395 } -396 else -397 { -398 throw new EmailException("embedded name '" + file.getName() -399 + "' is already bound to file " + existingFilePath -400 + "; existing names cannot be rebound"); -401 } +308 /** +309 * Embeds a file in the HTML. This implementation delegates to +310 * {@link #embed(File, String)}. +311 * +312 * @param file The <code>File</code> object to embed +313 * @return A String with the Content-ID of the file. +314 * @throws EmailException when the supplied <code>File</code> cannot be +315 * used; also see {@link javax.mail.internet.MimeBodyPart} for definitions +316 * +317 * @see #embed(File, String) +318 * @since 1.1 +319 */ +320 public String embed(final File file) throws EmailException +321 { +322 final String cid = EmailUtils.randomAlphabetic(HtmlEmail.CID_LENGTH).toLowerCase(Locale.ENGLISH); +323 return embed(file, cid); +324 } +325 +326 /** +327 * Embeds a file in the HTML. +328 * +329 * <p>This method embeds a file located by an URL into +330 * the mail body. It allows, for instance, to add inline images +331 * to the email. Inline files may be referenced with a +332 * <code>cid:xxxxxx</code> URL, where xxxxxx is the Content-ID +333 * returned by the embed function. Files are bound to their names, which is +334 * the value returned by {@link java.io.File#getName()}. If the same file +335 * is embedded multiple times, the same CID is guaranteed to be returned. +336 * +337 * <p>While functionally the same as passing <code>FileDataSource</code> to +338 * {@link #embed(DataSource, String, String)}, this method attempts +339 * to validate the file before embedding it in the message and will throw +340 * <code>EmailException</code> if the validation fails. In this case, the +341 * <code>HtmlEmail</code> object will not be changed. +342 * +343 * @param file The <code>File</code> to embed +344 * @param cid the Content-ID to use for the embedded <code>File</code> +345 * @return A String with the Content-ID of the file. +346 * @throws EmailException when the supplied <code>File</code> cannot be used +347 * or if the file has already been embedded; +348 * also see {@link javax.mail.internet.MimeBodyPart} for definitions +349 * @since 1.1 +350 */ +351 public String embed(final File file, final String cid) throws EmailException +352 { +353 if (EmailUtils.isEmpty(file.getName())) +354 { +355 throw new EmailException("file name cannot be null or empty"); +356 } +357 +358 // verify that the File can provide a canonical path +359 String filePath = null; +360 try +361 { +362 filePath = file.getCanonicalPath(); +363 } +364 catch (final IOException ioe) +365 { +366 throw new EmailException("couldn't get canonical path for " +367 + file.getName(), ioe); +368 } +369 +370 // check if a FileDataSource for this name has already been attached; +371 // if so, return the cached CID value. +372 if (inlineEmbeds.containsKey(file.getName())) +373 { +374 final InlineImage ii = inlineEmbeds.get(file.getName()); +375 final FileDataSource fileDataSource = (FileDataSource) ii.getDataSource(); +376 // make sure the supplied file has the same canonical path +377 // as the one already associated with this name. +378 String existingFilePath = null; +379 try +380 { +381 existingFilePath = fileDataSource.getFile().getCanonicalPath(); +382 } +383 catch (final IOException ioe) +384 { +385 throw new EmailException("couldn't get canonical path for file " +386 + fileDataSource.getFile().getName() +387 + "which has already been embedded", ioe); +388 } +389 if (filePath.equals(existingFilePath)) +390 { +391 return ii.getCid(); +392 } +393 throw new EmailException("embedded name '" + file.getName() +394 + "' is already bound to file " + existingFilePath +395 + "; existing names cannot be rebound"); +396 } +397 +398 // verify that the file is valid +399 if (!file.exists()) +400 { +401 throw new EmailException("file " + filePath + " doesn't exist"); 402 } -403 -404 // verify that the file is valid -405 if (!file.exists()) -406 { -407 throw new EmailException("file " + filePath + " doesn't exist"); -408 } -409 if (!file.isFile()) -410 { -411 throw new EmailException("file " + filePath + " isn't a normal file"); -412 } -413 if (!file.canRead()) -414 { -415 throw new EmailException("file " + filePath + " isn't readable"); -416 } -417 -418 return embed(new FileDataSource(file), file.getName(), cid); -419 } -420 -421 /** -422 * Embeds the specified <code>DataSource</code> in the HTML using a -423 * randomly generated Content-ID. Returns the generated Content-ID string. -424 * -425 * @param dataSource the <code>DataSource</code> to embed -426 * @param name the name that will be set in the filename header field -427 * @return the generated Content-ID for this <code>DataSource</code> -428 * @throws EmailException if the embedding fails or if <code>name</code> is -429 * null or empty -430 * @see #embed(DataSource, String, String) -431 * @since 1.1 -432 */ -433 public String embed(final DataSource dataSource, final String name) throws EmailException -434 { -435 // check if the DataSource has already been attached; -436 // if so, return the cached CID value. -437 if (inlineEmbeds.containsKey(name)) -438 { -439 final InlineImage ii = inlineEmbeds.get(name); -440 // make sure the supplied URL points to the same thing -441 // as the one already associated with this name. -442 if (dataSource.equals(ii.getDataSource())) -443 { -444 return ii.getCid(); -445 } -446 else -447 { -448 throw new EmailException("embedded DataSource '" + name -449 + "' is already bound to name " + ii.getDataSource().toString() -450 + "; existing names cannot be rebound"); -451 } -452 } -453 -454 final String cid = EmailUtils.randomAlphabetic(HtmlEmail.CID_LENGTH).toLowerCase(); -455 return embed(dataSource, name, cid); -456 } -457 -458 /** -459 * Embeds the specified <code>DataSource</code> in the HTML using the -460 * specified Content-ID. Returns the specified Content-ID string. -461 * -462 * @param dataSource the <code>DataSource</code> to embed -463 * @param name the name that will be set in the filename header field -464 * @param cid the Content-ID to use for this <code>DataSource</code> -465 * @return the URL encoded Content-ID for this <code>DataSource</code> -466 * @throws EmailException if the embedding fails or if <code>name</code> is -467 * null or empty -468 * @since 1.1 -469 */ -470 public String embed(final DataSource dataSource, final String name, String cid) -471 throws EmailException -472 { -473 if (EmailUtils.isEmpty(name)) -474 { -475 throw new EmailException("name cannot be null or empty"); -476 } -477 -478 final MimeBodyPart mbp = new MimeBodyPart(); -479 -480 try -481 { -482 // url encode the cid according to rfc 2392 -483 cid = EmailUtils.encodeUrl(cid); -484 -485 mbp.setDataHandler(new DataHandler(dataSource)); -486 mbp.setFileName(name); -487 mbp.setDisposition(EmailAttachment.INLINE); -488 mbp.setContentID("<" + cid + ">"); -489 -490 final InlineImage ii = new InlineImage(cid, dataSource, mbp); -491 this.inlineEmbeds.put(name, ii); -492 -493 return cid; -494 } -495 catch (final MessagingException me) -496 { -497 throw new EmailException(me); -498 } -499 catch (final UnsupportedEncodingException uee) -500 { -501 throw new EmailException(uee); -502 } -503 } -504 -505 /** -506 * Does the work of actually building the MimeMessage. Please note that -507 * a user rarely calls this method directly and only if he/she is -508 * interested in the sending the underlying MimeMessage without -509 * commons-email. -510 * -511 * @exception EmailException if there was an error. -512 * @since 1.0 -513 */ -514 @Override -515 public void buildMimeMessage() throws EmailException -516 { -517 try -518 { -519 build(); -520 } -521 catch (final MessagingException me) -522 { -523 throw new EmailException(me); -524 } -525 super.buildMimeMessage(); -526 } -527 -528 /** -529 * @throws EmailException EmailException -530 * @throws MessagingException MessagingException -531 */ -532 private void build() throws MessagingException, EmailException -533 { -534 final MimeMultipart rootContainer = this.getContainer(); -535 MimeMultipart bodyEmbedsContainer = rootContainer; -536 MimeMultipart bodyContainer = rootContainer; -537 MimeBodyPart msgHtml = null; -538 MimeBodyPart msgText = null; -539 -540 rootContainer.setSubType("mixed"); +403 if (!file.isFile()) +404 { +405 throw new EmailException("file " + filePath + " isn't a normal file"); +406 } +407 if (!file.canRead()) +408 { +409 throw new EmailException("file " + filePath + " isn't readable"); +410 } +411 +412 return embed(new FileDataSource(file), file.getName(), cid); +413 } +414 +415 /** +416 * Embeds the specified <code>DataSource</code> in the HTML using a +417 * randomly generated Content-ID. Returns the generated Content-ID string. +418 * +419 * @param dataSource the <code>DataSource</code> to embed +420 * @param name the name that will be set in the filename header field +421 * @return the generated Content-ID for this <code>DataSource</code> +422 * @throws EmailException if the embedding fails or if <code>name</code> is +423 * null or empty +424 * @see #embed(DataSource, String, String) +425 * @since 1.1 +426 */ +427 public String embed(final DataSource dataSource, final String name) throws EmailException +428 { +429 // check if the DataSource has already been attached; +430 // if so, return the cached CID value. +431 if (inlineEmbeds.containsKey(name)) +432 { +433 final InlineImage ii = inlineEmbeds.get(name); +434 // make sure the supplied URL points to the same thing +435 // as the one already associated with this name. +436 if (dataSource.equals(ii.getDataSource())) +437 { +438 return ii.getCid(); +439 } +440 throw new EmailException("embedded DataSource '" + name +441 + "' is already bound to name " + ii.getDataSource().toString() +442 + "; existing names cannot be rebound"); +443 } +444 +445 final String cid = EmailUtils.randomAlphabetic(HtmlEmail.CID_LENGTH).toLowerCase(); +446 return embed(dataSource, name, cid); +447 } +448 +449 /** +450 * Embeds the specified <code>DataSource</code> in the HTML using the +451 * specified Content-ID. Returns the specified Content-ID string. +452 * +453 * @param dataSource the <code>DataSource</code> to embed +454 * @param name the name that will be set in the filename header field +455 * @param cid the Content-ID to use for this <code>DataSource</code> +456 * @return the URL encoded Content-ID for this <code>DataSource</code> +457 * @throws EmailException if the embedding fails or if <code>name</code> is +458 * null or empty +459 * @since 1.1 +460 */ +461 public String embed(final DataSource dataSource, final String name, final String cid) +462 throws EmailException +463 { +464 if (EmailUtils.isEmpty(name)) +465 { +466 throw new EmailException("name cannot be null or empty"); +467 } +468 +469 final MimeBodyPart mbp = new MimeBodyPart(); +470 +471 try +472 { +473 // URL encode the cid according to RFC 2392 +474 String encodedCid = EmailUtils.encodeUrl(cid); +475 +476 mbp.setDataHandler(new DataHandler(dataSource)); +477 mbp.setFileName(name); +478 mbp.setDisposition(EmailAttachment.INLINE); +479 mbp.setContentID("<" + encodedCid + ">"); +480 +481 final InlineImage ii = new InlineImage(encodedCid, dataSource, mbp); +482 this.inlineEmbeds.put(name, ii); +483 +484 return encodedCid; +485 } +486 catch (final MessagingException me) +487 { +488 throw new EmailException(me); +489 } +490 catch (final UnsupportedEncodingException uee) +491 { +492 throw new EmailException(uee); +493 } +494 } +495 +496 /** +497 * Does the work of actually building the MimeMessage. Please note that +498 * a user rarely calls this method directly and only if he/she is +499 * interested in the sending the underlying MimeMessage without +500 * commons-email. +501 * +502 * @exception EmailException if there was an error. +503 * @since 1.0 +504 */ +505 @Override +506 public void buildMimeMessage() throws EmailException +507 { +508 try +509 { +510 build(); +511 } +512 catch (final MessagingException me) +513 { +514 throw new EmailException(me); +515 } +516 super.buildMimeMessage(); +517 } +518 +519 /** +520 * @throws EmailException EmailException +521 * @throws MessagingException MessagingException +522 */ +523 private void build() throws MessagingException, EmailException +524 { +525 final MimeMultipart rootContainer = this.getContainer(); +526 MimeMultipart bodyEmbedsContainer = rootContainer; +527 MimeMultipart bodyContainer = rootContainer; +528 MimeBodyPart msgHtml = null; +529 MimeBodyPart msgText = null; +530 +531 rootContainer.setSubType("mixed"); +532 +533 // determine how to form multiparts of email +534 +535 if (EmailUtils.isNotEmpty(this.html) && this.inlineEmbeds.size() > 0) +536 { +537 //If HTML body and embeds are used, create a related container and add it to the root container +538 bodyEmbedsContainer = new MimeMultipart("related"); +539 bodyContainer = bodyEmbedsContainer; +540 this.addPart(bodyEmbedsContainer, 0); 541 -542 // determine how to form multiparts of email -543 -544 if (EmailUtils.isNotEmpty(this.html) && this.inlineEmbeds.size() > 0) -545 { -546 //If HTML body and embeds are used, create a related container and add it to the root container -547 bodyEmbedsContainer = new MimeMultipart("related"); -548 bodyContainer = bodyEmbedsContainer; -549 this.addPart(bodyEmbedsContainer, 0); -550 -551 //If TEXT body was specified, create a alternative container and add it to the embeds container -552 if (EmailUtils.isNotEmpty(this.text)) -553 { -554 bodyContainer = new MimeMultipart("alternative"); -555 final BodyPart bodyPart = createBodyPart(); -556 try -557 { -558 bodyPart.setContent(bodyContainer); -559 bodyEmbedsContainer.addBodyPart(bodyPart, 0); -560 } -561 catch (final MessagingException me) -562 { -563 throw new EmailException(me); -564 } -565 } -566 } -567 else if (EmailUtils.isNotEmpty(this.text) && EmailUtils.isNotEmpty(this.html)) -568 { -569 //If both HTML and TEXT bodies are provided, create a alternative container and add it to the root container -570 bodyContainer = new MimeMultipart("alternative"); -571 this.addPart(bodyContainer, 0); -572 } -573 -574 if (EmailUtils.isNotEmpty(this.html)) -575 { -576 msgHtml = new MimeBodyPart(); -577 bodyContainer.addBodyPart(msgHtml, 0); +542 // If TEXT body was specified, create a alternative container and add it to the embeds container +543 if (EmailUtils.isNotEmpty(this.text)) +544 { +545 bodyContainer = new MimeMultipart("alternative"); +546 final BodyPart bodyPart = createBodyPart(); +547 try +548 { +549 bodyPart.setContent(bodyContainer); +550 bodyEmbedsContainer.addBodyPart(bodyPart, 0); +551 } +552 catch (final MessagingException me) +553 { +554 throw new EmailException(me); +555 } +556 } +557 } +558 else if (EmailUtils.isNotEmpty(this.text) && EmailUtils.isNotEmpty(this.html)) +559 { +560 // EMAIL-142: if we have both an HTML and TEXT body, but no attachments or +561 // inline images, the root container should have mimetype +562 // "multipart/alternative". +563 // reference: http://tools.ietf.org/html/rfc2046#section-5.1.4 +564 if (this.inlineEmbeds.size() > 0 || isBoolHasAttachments()) +565 { +566 // If both HTML and TEXT bodies are provided, create an alternative +567 // container and add it to the root container +568 bodyContainer = new MimeMultipart("alternative"); +569 this.addPart(bodyContainer, 0); +570 } +571 else +572 { +573 // no attachments or embedded images present, change the mimetype +574 // of the root container (= body container) +575 rootContainer.setSubType("alternative"); +576 } +577 } 578 -579 // EMAIL-104: call explicitly setText to use default mime charset -580 // (property "mail.mime.charset") in case none has been set -581 msgHtml.setText(this.html, this.charset, EmailConstants.TEXT_SUBTYPE_HTML); -582 -583 for (final InlineImage image : this.inlineEmbeds.values()) -584 { -585 bodyEmbedsContainer.addBodyPart(image.getMbp()); -586 } -587 } -588 -589 if (EmailUtils.isNotEmpty(this.text)) -590 { -591 msgText = new MimeBodyPart(); -592 bodyContainer.addBodyPart(msgText, 0); -593 -594 // EMAIL-104: call explicitly setText to use default mime charset -595 // (property "mail.mime.charset") in case none has been set -596 msgText.setText(this.text, this.charset); -597 } -598 } -599 -600 /** -601 * Private bean class that encapsulates data about URL contents -602 * that are embedded in the final email. -603 * @since 1.1 -604 */ -605 private static class InlineImage -606 { -607 /** content id. */ -608 private final String cid; -609 /** <code>DataSource</code> for the content. */ -610 private final DataSource dataSource; -611 /** the <code>MimeBodyPart</code> that contains the encoded data. */ -612 private final MimeBodyPart mbp; +579 if (EmailUtils.isNotEmpty(this.html)) +580 { +581 msgHtml = new MimeBodyPart(); +582 bodyContainer.addBodyPart(msgHtml, 0); +583 +584 // EMAIL-104: call explicitly setText to use default mime charset +585 // (property "mail.mime.charset") in case none has been set +586 msgHtml.setText(this.html, this.charset, EmailConstants.TEXT_SUBTYPE_HTML); +587 +588 // EMAIL-147: work-around for buggy JavaMail implementations; +589 // in case setText(...) does not set the correct content type, +590 // use the setContent() method instead. +591 final String contentType = msgHtml.getContentType(); +592 if (contentType == null || !contentType.equals(EmailConstants.TEXT_HTML)) +593 { +594 // apply default charset if one has been set +595 if (EmailUtils.isNotEmpty(this.charset)) +596 { +597 msgHtml.setContent(this.html, EmailConstants.TEXT_HTML + "; charset=" + this.charset); +598 } +599 else +600 { +601 // unfortunately, MimeUtility.getDefaultMIMECharset() is package private +602 // and thus can not be used to set the default system charset in case +603 // no charset has been provided by the user [... 200 lines stripped ...]