Examples of addBodyPart()


Examples of javax.mail.Multipart.addBodyPart()

          message.setSubject(subject);
          BodyPart messageBodyPart        = new MimeBodyPart();
          String messageContext = "text/plain";
          messageBodyPart.setContent(body, messageContext);
          Multipart multipart             = new MimeMultipart();
          multipart.addBodyPart(messageBodyPart);
          messageBodyPart = new MimeBodyPart();
          message.setContent(multipart);
          Transport.send(message);
        }//end of try block
        catch (Exception e)
View Full Code Here

Examples of javax.mail.Multipart.addBodyPart()

         mbp1.setFileName(attachmentName);
         // mbp1.getContentType(); "application/octet-stream"

         // create the Multipart and add its parts to it
         Multipart mp = new MimeMultipart();
         mp.addBodyPart(mbp1);

         if (attachmentName2 != null) {
            MimeBodyPart mbp2 = new MimeBodyPart(); // "text/plain"
            mbp2.setText(attachment2, encoding);
            mbp2.setFileName(attachmentName2);
View Full Code Here

Examples of javax.mail.Multipart.addBodyPart()

         if (attachmentName2 != null) {
            MimeBodyPart mbp2 = new MimeBodyPart(); // "text/plain"
            mbp2.setText(attachment2, encoding);
            mbp2.setFileName(attachmentName2);
            mp.addBodyPart(mbp2);
         }

         // add the Multipart to the message
         message.setContent(mp);
View Full Code Here

Examples of javax.mail.Multipart.addBodyPart()

            if (emailData.getContent() != null && emailData.getContent().length() > 0) {
               MimeBodyPart mbp = new MimeBodyPart();
               mbp.setFileName("content.txt");
               mbp.setText(emailData.getContent(), Constants.UTF8_ENCODING);
               mbp.setDisposition(MimeBodyPart.INLINE);
               multi.addBodyPart(mbp);
            }
  
            for (int i=0; i<holder.length; i++) {
               MimeBodyPart mbp = new MimeBodyPart();
               // 'AA xmlBlasterMessage.xbf' will be automatically quoted to '"AA xmlBlasterMessage.xbf"' by javamail implementation
View Full Code Here

Examples of javax.mail.Multipart.addBodyPart()

                  DataSource ds = new ByteArrayDataSource(
                        content,
                        holder[i].getContentType());
                  mbp.setDataHandler(new DataHandler(ds));
               }
               multi.addBodyPart(mbp);
            }
  
            // add the Multipart to the message
            message.setContent(multi);
         } // else multipart
View Full Code Here

Examples of javax.mail.Multipart.addBodyPart()

    DataHandler dh = new DataHandler(fileAttachment);
    bp2.setDataHandler(dh);
    bp2.setFileName(fileAttachment.getName());

    Multipart multipart = new MimeMultipart();
    multipart.addBodyPart(bp1);
    multipart.addBodyPart(bp2);

    baseMsg.setFrom(new InternetAddress("Ted <ted@home.com>"));
    baseMsg.setRecipient(Message.RecipientType.TO, new InternetAddress(
        "success@subethamail.org"));
View Full Code Here

Examples of javax.mail.Multipart.addBodyPart()

    bp2.setDataHandler(dh);
    bp2.setFileName(fileAttachment.getName());

    Multipart multipart = new MimeMultipart();
    multipart.addBodyPart(bp1);
    multipart.addBodyPart(bp2);

    baseMsg.setFrom(new InternetAddress("Ted <ted@home.com>"));
    baseMsg.setRecipient(Message.RecipientType.TO, new InternetAddress(
        "success@subethamail.org"));
    baseMsg.setSubject("Test Big attached file message");
View Full Code Here

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

          //props.put("mail.smtp.from", "<>");
 
          Multipart multipart = new MimeMultipart("related");
      MimeBodyPart messageBodyPart = new MimeBodyPart();
          messageBodyPart.setText("Welcome to JavaMail.");
          multipart.addBodyPart(messageBodyPart);
          mailMessage.setContent(multipart);
          mailMessage.setFrom(new InternetAddress("javayou@gmail.com","Winter Lau"));
         
          String mail_postfix = mailaddr.substring(mailaddr.indexOf('@')+1);
          //System.out.println("mail postfix is " + mail_postfix);
View Full Code Here

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

        //Create attachments
        DataSource[] attachments = mailMessage.getAttachments();
        for (int i = 0; i < attachments.length; i++) {
            DataSource attachment = attachments[i];
            MimeBodyPart attachmentPart = createAttachmentPart(attachment);
            content.addBodyPart(attachmentPart);
        }
       
        //Create message body
        MimeBodyPart bodyPart = createMessageBodyPart(mailMessage.getBody(), mailMessage.isBodyHtml());
        content.addBodyPart(bodyPart);
View Full Code Here

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

            content.addBodyPart(attachmentPart);
        }
       
        //Create message body
        MimeBodyPart bodyPart = createMessageBodyPart(mailMessage.getBody(), mailMessage.isBodyHtml());
        content.addBodyPart(bodyPart);

        if (from == null) {
            message.setFrom();
        } else {
            message.setFrom(new InternetAddress(from));
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.