Package javax.mail.internet

Examples of javax.mail.internet.MimeMultipart.addBodyPart()


               InternetHeaders headers = new InternetHeaders();

               headers.addHeader(FileUpload.CONTENT_DISPOSITION, paramContentDispositionHeader + formParam.getName() + "\"");

               MimeBodyPart mimeBodyPart = new MimeBodyPart(headers, formParam.getValue().getBytes());
               parts.addBodyPart(mimeBodyPart);
              
              
               String paramName = formParam.getName();
               String paramValue = formParam.getValue();
               if (params.containsKey(paramName))
View Full Code Here


        emailToInternetAddressArray(ccEmailAddresses));
    message.addFrom(InternetAddress.parse(fromAddress));
    message.setSentDate(new Date());
    BodyPart mainBody = new MimeBodyPart();
    mainBody.setContent(content, "text/html;charset=gbk");
    multipart.addBodyPart(mainBody);
    for (Entry<String, String> e : mailAttachment.entrySet()) {
      BodyPart bodyPart = new MimeBodyPart();
      bodyPart.setDataHandler(new DataHandler(new FileDataSource(e
          .getKey())));
      bodyPart.setFileName(e.getValue());
View Full Code Here

      BodyPart bodyPart = new MimeBodyPart();
      bodyPart.setDataHandler(new DataHandler(new FileDataSource(e
          .getKey())));
      bodyPart.setFileName(e.getValue());
      bodyPart.setHeader("Content-ID", e.getValue());
      multipart.addBodyPart(bodyPart);
    }
    message.setContent(multipart);
    message.saveChanges();
    Transport.send(message, message.getAllRecipients());
    Misc.getLogger().info("Send Mail success!");
View Full Code Here

        emailToInternetAddressArray(ccEmailAddresses));
    message.addFrom(InternetAddress.parse(fromAddress));
    message.setSentDate(new Date());
    BodyPart mainBody = new MimeBodyPart();
    mainBody.setContent(content, "text/html;charset=gbk");
    multipart.addBodyPart(mainBody);
    for (Entry<String, String> e : mailAttachment.entrySet()) {
      BodyPart bodyPart = new MimeBodyPart();
      bodyPart.setDataHandler(new DataHandler(new FileDataSource(e
          .getKey())));
      bodyPart.setFileName(e.getValue());
View Full Code Here

      BodyPart bodyPart = new MimeBodyPart();
      bodyPart.setDataHandler(new DataHandler(new FileDataSource(e
          .getKey())));
      bodyPart.setFileName(e.getValue());
      bodyPart.setHeader("Content-ID", e.getValue());
      multipart.addBodyPart(bodyPart);
    }
    message.setContent(multipart);
    message.saveChanges();
    Transport.send(message, message.getAllRecipients());
  }
View Full Code Here

                    String fileName = (String) bodyPart.get("filename");
                    if (fileName != null) {
                        mbp.setFileName(fileName);
                    }
                    mp.addBodyPart(mbp);
                }
                mail.setContent(mp);
                mail.saveChanges();
            } else {
                // create the singelpart message
View Full Code Here

        // fill the body with text
        multipart.setSubType("mixed");
        MimeBodyPart textBodyPart = new MimeBodyPart();
        textBodyPart.setContent(camelMessage.getBody(String.class), configuration.getContentType());
        multipart.addBodyPart(textBodyPart);

        for (Map.Entry<String, DataHandler> entry : camelMessage.getAttachments().entrySet()) {
            String attachmentFilename = entry.getKey();
            DataHandler handler = entry.getValue();
            if (handler != null) {
View Full Code Here

                    // Set the filename
                    messageBodyPart.setFileName(attachmentFilename);
                    // Set Disposition
                    messageBodyPart.setDisposition(Part.ATTACHMENT);
                    // Add part to multipart
                    multipart.addBodyPart(messageBodyPart);
                }
            }
        }

        // Put parts in message
View Full Code Here

        MimeBodyPart htmlPart = new MimeBodyPart();
        htmlPart.setText("<html><body>" + body + "</body></html>");

        Multipart alt = new MimeMultipart("alternative");
        alt.addBodyPart(plainPart);
        alt.addBodyPart(htmlPart);

        Multipart mixed = new MimeMultipart("mixed");
        MimeBodyPart wrap = new MimeBodyPart();
        wrap.setContent(alt);
View Full Code Here

        MimeBodyPart htmlPart = new MimeBodyPart();
        htmlPart.setText("<html><body>" + body + "</body></html>");

        Multipart alt = new MimeMultipart("alternative");
        alt.addBodyPart(plainPart);
        alt.addBodyPart(htmlPart);

        Multipart mixed = new MimeMultipart("mixed");
        MimeBodyPart wrap = new MimeBodyPart();
        wrap.setContent(alt);
        mixed.addBodyPart(wrap);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.