Exemplo n.º 1
0
  Multipart composeMessageBody(ItemOrder order) throws MessagingException {
    String html = htmlCreator.generateHtmlImage(order.getItemResponse().getImgBaseSrc());

    BodyPart mediaPart = new MimeBodyPart();
    mediaPart.setContent(html, "text/html");

    BodyPart textPart = new MimeBodyPart();
    textPart.setContent(order.dump(), "text/plain; charset=UTF-8");

    Multipart messageBody = new MimeMultipart();
    messageBody.addBodyPart(textPart);
    messageBody.addBodyPart(mediaPart);

    return messageBody;
  }
Exemplo n.º 2
0
  protected void setMessageContent(MimeMessage mail, ItemOrder order) throws MessagingException {
    Multipart messageBody = composeMessageBody(order);
    mail.setContent(messageBody);

    log.info(String.format("Order %s", order.dump()));
  }