Ejemplo 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;
  }
Ejemplo n.º 2
0
 protected void setMessageAddresses(MimeMessage mail, ItemOrder order)
     throws AddressException, MessagingException {
   InternetAddress destination = InternetAddress.parse(destinationAddress)[0];
   mail.setFrom(destination);
   mail.setReplyTo(InternetAddress.parse(order.getCustomerEmail()));
   mail.setRecipient(RecipientType.TO, destination);
 }
Ejemplo n.º 3
0
 protected void setMessageSubject(MimeMessage mail, ItemOrder order) throws MessagingException {
   String subject =
       context.getMessage(
           SUBJECT_MESSAGE_KEY,
           new Object[] {order.getItemResponse().getId()},
           Locale.getDefault());
   mail.setSubject(subject, "UTF-8");
 }
Ejemplo n.º 4
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()));
  }