Package javax.mail

Examples of javax.mail.Multipart


  private String getContentFromHTML(Part p) throws MessagingException,
      IOException, DecoderException, SAXException, TikaException {
    StringBuffer content = new StringBuffer("");
    if (p.isMimeType("multipart/*")) {
      Multipart mp = (Multipart) p.getContent();
      int count = mp.getCount();
      for (int i = 0; i < count; i++)
        content.append(getContentFromHTML(mp.getBodyPart(i)));
    } else if (p.isMimeType("text/html")) {
      HtmlParser parser = new HtmlParser();
      Metadata met = new Metadata();
      TextContentHandler handler = new TextContentHandler(
          new BodyContentHandler());
View Full Code Here


          part = new MimeBodyPart();
          part.setContent(contentBuilder.toString(), layout.getContentType());
        }
      }
     
      Multipart mp = new MimeMultipart();
      mp.addBodyPart(part);
      msg.setContent(mp);
     
      msg.setSentDate(new Date());
      send(msg);
    } catch (MessagingException e) {
View Full Code Here

            //MENSAGEM QUE VAI NO CORPO DO EMAIL
            MimeBodyPart mbpMensagem = new MimeBodyPart();
            mbpMensagem.setText(mensagem);

            //PARTES DO EMAIL
            Multipart mp = new MimeMultipart();
            mp.addBodyPart(mbpMensagem);
           

            //ASSUNTO DO EMAIL
            mailMessage.setSubject(assunto);
           
View Full Code Here

      // matching email content:
      String body = "";
      if (message.getContent() instanceof String) {
        body = message.getContent().toString();
      } else if (message.getContent() instanceof Multipart) {
        Multipart multipart = (Multipart) message.getContent();
        BodyPart bodypart = multipart.getBodyPart(0);
        body = bodypart.getContent().toString();
      }

      // check line 1: "The results of the evaluation:"
      if (body.indexOf("The results of the evaluation:") == -1) {
View Full Code Here

      // matching email content:
      String body = "";
      if (message.getContent() instanceof String) {
        body = message.getContent().toString();
      } else if (message.getContent() instanceof Multipart) {
        Multipart multipart = (Multipart) message.getContent();
        BodyPart bodypart = multipart.getBodyPart(0);
        body = bodypart.getContent().toString();
      }

      // check line 1: "The results of the evaluation:"
      if (body.indexOf("The results of the evaluation:") == -1) {
View Full Code Here

          body = message.getContent().toString();
        } else if (message.getContent() instanceof Multipart) { // if
                                    // its a
          // multipart
          // message
          Multipart multipart = (Multipart) message.getContent();
          BodyPart bodypart = multipart.getBodyPart(0);
          body = bodypart.getContent().toString();
        }

       
        String key = body.split(courseId+":")[1];
View Full Code Here

                              // string
        body = message.getContent().toString();
      } else if (message.getContent() instanceof Multipart) { // if its a
                                  // multipart
                                  // message
        Multipart multipart = (Multipart) message.getContent();
        BodyPart bodypart = multipart.getBodyPart(0);
        body = bodypart.getContent().toString();
      }

      System.out.println("message: \n" + body);
View Full Code Here

          body = message.getContent().toString();
        } else if (message.getContent() instanceof Multipart) { // if
                                    // its a
          // multipart
          // message
          Multipart multipart = (Multipart) message.getContent();
          BodyPart bodypart = multipart.getBodyPart(0);
          body = bodypart.getContent().toString();
        }

       
        String key = body.split(courseId+":")[1];
View Full Code Here

          BodyPart messageBodyPart = new MimeBodyPart();
          // Fill the message
          messageBodyPart
              .setText("Estimado usuario, se adjuntan las novedades del dia anterior");

          Multipart multipart = new MimeMultipart();
          multipart.addBodyPart(messageBodyPart);
          // Part two is attachment
          messageBodyPart = new MimeBodyPart();
          DataSource source = new ByteArrayDataSource(pdf,
              "application/pdf");
          messageBodyPart.setDataHandler(new DataHandler(source));
          messageBodyPart.setFileName("novedades.pdf");
          messageBodyPart.setDisposition(Part.ATTACHMENT);
          multipart.addBodyPart(messageBodyPart);
          // Put parts in message
          message.setContent(multipart);
          // Send the message
          Transport.send(message);
        }
View Full Code Here

          BodyPart messageBodyPart = new MimeBodyPart();
          // Fill the message
          messageBodyPart
              .setText("Estimado " + nombres + " " + apepa + ", se adjuntan las novedades del dia " + fechadeayer);

          Multipart multipart = new MimeMultipart();
          multipart.addBodyPart(messageBodyPart);
          // Part two is attachment
          messageBodyPart = new MimeBodyPart();
          DataSource source = new ByteArrayDataSource(pdf,
              "application/pdf");
          messageBodyPart.setDataHandler(new DataHandler(source));
          messageBodyPart.setFileName("novedades_"+fechadeayer2+".pdf");
          messageBodyPart.setDisposition(Part.ATTACHMENT);
          multipart.addBodyPart(messageBodyPart);
          // Put parts in message
          message.setContent(multipart);
          // Send the message
          Transport.send(message);
View Full Code Here

TOP

Related Classes of javax.mail.Multipart

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.