Package javax.mail.internet

Examples of javax.mail.internet.MimeMultipart$MimeBodyPartInputStream


  
            if (mp.getBodyPart(i).isMimeType("text/plain")) {
              return (String) mp.getBodyPart(i).getContent();
  
            } else if (mp.getBodyPart(i).isMimeType("multipart/*")) {
                MimeMultipart mmp = (MimeMultipart) mp.getBodyPart(i).getContent();
                int numBodyParts = mmp.getCount();
  
                for (int j = 0; j < numBodyParts; ++j) {
                  if (mmp.getBodyPart(j).isMimeType("text/plain")) {
                    return (String) mmp.getBodyPart(j).getContent();
                  }
                }
            }
          }
  
View Full Code Here


      
//      Attachments entfernen

        Object mmpo=mimeMessage.getContent();
        if (  ( mmpo instanceof MimeMultipart ) ){
            MimeMultipart mmp= (MimeMultipart) mmpo;
     
            if (mimeMessage.isMimeType("text/plain")) {
            } else if (mimeMessage.isMimeType("multipart/*")) {
              mmp=(MimeMultipart)mimeMessage.getContent();
              for (int i = 1; i < mmp.getCount(); i++) {
                BodyPart part = mmp.getBodyPart(i);
                mmp.removeBodyPart(i);
                i--;
              }
            } 
            mimeMessage.setContent(mmp);
            }//if 
View Full Code Here

        }
      
        BodyPart messageBodyPart = new MimeBodyPart();
        messageBodyPart.setText(forwardSubject);

        Multipart multipart = new MimeMultipart();
        multipart.addBodyPart(messageBodyPart);

        messageBodyPart = new MimeBodyPart();
        messageBodyPart.setDataHandler(message.getDataHandler());

        multipart.addBodyPart(messageBodyPart);

        forward.setContent(multipart);

        Transport.send(forward);
       
View Full Code Here

   
    // -- Create a new message --
    BodyPart msg = new MimeBodyPart();
    msg.setDataHandler(new DataHandler(new ByteArrayDataSource(htmlBody, "text/html; charset=\"utf-8\"")));
   
    Multipart multipart = new MimeMultipart();
   
    BodyPart iCalAttachment = new MimeBodyPart();
    iCalAttachment.setDataHandler(new DataHandler(new javax.mail.util.ByteArrayDataSource(new ByteArrayInputStream(iCalMimeBody), "text/calendar;method=REQUEST;charset=\"UTF-8\"")));

    multipart.addBodyPart(iCalAttachment);
    multipart.addBodyPart(msg);
   
    mimeMessage.setContent(multipart);
   
    // -- Set some other header information --
    //mimeMessage.setHeader("X-Mailer", "XML-Mail");
View Full Code Here

  public boolean checkSignature(EncryptionUtils utils, Key key)
    throws MessagingException, java.io.IOException, java.security.GeneralSecurityException {

    Object content = getDataHandler().getContent();
    if (content instanceof MimeMultipart) {
      MimeMultipart mp = (MimeMultipart) content;
      return utils.checkSignature(mp, key);
    } /* else if((utils instanceof PGPEncryptionUtils) && (content instanceof String)){
      String s = (String) content;
      if (s.indexOf(PGPEncryptionUtils.BEGIN_PGP_SIGNED_MESSAGE) == 0) {
        PGPEncryptionUtils pgpUtils = (PGPEncryptionUtils) utils;
View Full Code Here

   */
  public MimeBodyPart getSignedPart() throws javax.mail.MessagingException,
                                             java.io.IOException {
    Object content = getDataHandler().getContent();
    if (content instanceof MimeMultipart) {
      MimeMultipart mm = (MimeMultipart) content;

      // this should be exactly two parts, one the content, the other the
      // signature.
      for (int i = 0; i < mm.getCount(); i++) {
        // return the first one found.
        MimeBodyPart mbp = (MimeBodyPart) mm.getBodyPart(i);
        ContentType ct = new ContentType(mbp.getContentType());
        if (! ct.getSubType().toLowerCase().endsWith("signature")) {
          return mbp;
        }
      }
View Full Code Here

     */
    public MimeMultipart getHtmlContent()
    {
        if (htmlContent == null)
        {
            htmlContent = new MimeMultipart();
        }
        return htmlContent;
    }
View Full Code Here

        MimeBodyPart msgHtml = null;

        if (StringUtils.isNotEmpty(text) && StringUtils.isNotEmpty(html))
        {
            // The message in text and HTML form.
            MimeMultipart msg = getHtmlContent();
            msg.setSubType("alternative");
            main.setContent(msg);

            msgText = new MimeBodyPart();
            msgHtml = new MimeBodyPart();
            msg.addBodyPart(msgText);
            msg.addBodyPart(msgHtml);

        }
        else if (StringUtils.isNotEmpty(text))
        {
            // just text so the text part is the main part
View Full Code Here

        super.init();

        fileServer = null;

        /* The body of the mail. */
        emailBody = new MimeMultipart();
        message.setContent(emailBody);

        /* The main message content. */
        main = new MimeBodyPart();
        emailBody.addBodyPart(main);
View Full Code Here

        SMTPTransport t = new SMTPTransport(session, null);

        MimeMessage msg = new MimeMessage(session);

        MimeMultipart mmpt = new MimeMultipart();
        MimeBodyPart b1 = new MimeBodyPart();
        b1.setContent("body 1", "text/plain");

        mmpt.addBodyPart(b1);

        b1 = new MimeBodyPart();
        b1.setContent("body2", "text/plain");
        mmpt.addBodyPart(b1);

        Address[] list = new Address[1];
        list[0] new InternetAddress("geirm@optonline.net");
//        list[1] =  new InternetAddress("jeremy@boynes.com");
View Full Code Here

TOP

Related Classes of javax.mail.internet.MimeMultipart$MimeBodyPartInputStream

Copyright © 2018 www.massapicom. 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.