Package javax.mail

Examples of javax.mail.Multipart.addBodyPart()


          // 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));
View Full Code Here


          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

          // 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));
View Full Code Here

          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

   */
  private void addMessageContent(MimeMessage oMessage) throws MessagingException {
    BodyPart oBodyP = new MimeBodyPart();
    Multipart oMultiP = new MimeMultipart();

    oMultiP.addBodyPart(oBodyP);
    oMessage.setContent(oMultiP);
    if (null == this.message) {
            this.message = "";
    }
    oBodyP.setText(this.message + "\n");
View Full Code Here

    oBodyP.setText(this.message + "\n");

       
        if (null != attachments) {
      for (int i1 = 0; i1 < this.attachments.length; i1++) {
              oMultiP.addBodyPart(oBodyP = new MimeBodyPart());
              String sFile = this.attachments[i1];
              oBodyP.setDataHandler(new DataHandler(new FileDataSource(sFile)));
              oBodyP.setFileName(sFile.substring(1 + sFile.lastIndexOf("\\")));
          }
        }
View Full Code Here

              oBodyP.setFileName(sFile.substring(1 + sFile.lastIndexOf("\\")));
          }
        }
       
        for (MimeBodyPart part : attachmentParts) {
            oMultiP.addBodyPart(part);
        }
  }
 
  /**
     * Initialise an authenticated {@link javax.mail.Session} with the mail server.
View Full Code Here

          log.debug("Returning certificate with issuerDN '"+CertTools.getIssuerDN(certs[i])+"' and subjectDN '"+CertTools.getSubjectDN(certs[i])+"'. Filename="+filename);
        }
        final InternetHeaders headers = new InternetHeaders();
        headers.addHeader("Content-type", "application/pkix-cert");
        headers.addHeader("Content-disposition", "attachment; filename="+filename);
        mp.addBodyPart(new MimeBodyPart(headers,certs[i].getEncoded()));
      }
      if (log.isTraceEnabled()) {
        log.trace("content type: "+mp.getContentType());       
      }
      mp.writeTo(resp.getOutputStream());
View Full Code Here

          } else {
            Multipart multipart = new MimeMultipart();
            // Add the text message first
            MimeBodyPart msgBody = new MimeBodyPart();
            msgBody.setContent(content, MailConfiguration.getMailMimeType());
            multipart.addBodyPart(msgBody);
            // Attach all the requested files
        for (int i=0; i<attachments.size(); i++) {
          MailAttachment mailAttachment = (MailAttachment) attachments.get(i);
              MimeBodyPart msgAttachment = new MimeBodyPart();
              msgAttachment.setDataHandler(mailAttachment.getDataHandler());
View Full Code Here

        for (int i=0; i<attachments.size(); i++) {
          MailAttachment mailAttachment = (MailAttachment) attachments.get(i);
              MimeBodyPart msgAttachment = new MimeBodyPart();
              msgAttachment.setDataHandler(mailAttachment.getDataHandler());
              msgAttachment.setFileName(mailAttachment.getName());
              multipart.addBodyPart(msgAttachment);
            }
            msg.setContent(multipart);
          }
          msg.setHeader("X-Mailer", "JavaMailer");
          msg.setSentDate(new Date());
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.