Package javax.mail

Examples of javax.mail.Multipart.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


        BodyPart messageBodyPart = new MimeBodyPart();
        String text = "Summary\n-------\n\n" + summary + "\n\nDescription\n-----------\n\n" + description;
        messageBodyPart.setText( text );
        messageBodyPart.setDataHandler( new DataHandler( new ByteArrayDataSource( text,
                                                                                  "text/plain; charset=UTF8;" ) ) );
        multipart.addBodyPart( messageBodyPart );

        // Add ical
        messageBodyPart = new MimeBodyPart();
        String filename = "ical-" + type + "-" + taskId + ".ics";
        messageBodyPart.setFileName( filename );
View Full Code Here

                                  creatorEmail,
                                  type );

        messageBodyPart.setDataHandler( new DataHandler( new ByteArrayDataSource( icalStr,
                                                                                  "text/calendar; charset=UTF8; " ) ) );
        multipart.addBodyPart( messageBodyPart );

        message.setContent( multipart );
        message.saveChanges();

        Transport.send( message );
View Full Code Here

        MimeBodyPart htmlPart = new MimeBodyPart();
        htmlPart.setDataHandler(new DataHandler(htmlDataSource));
        // create the Multipart
        // and its parts to it
        Multipart bodyAlternatives = new MimeMultipart("alternative");
        bodyAlternatives.addBodyPart(plainTextVersion);
        htmlPart.setHeader("Content-Type", "text/html; charset=UTF-8");
        bodyAlternatives.addBodyPart(htmlPart);


View Full Code Here

        // create the Multipart
        // and its parts to it
        Multipart bodyAlternatives = new MimeMultipart("alternative");
        bodyAlternatives.addBodyPart(plainTextVersion);
        htmlPart.setHeader("Content-Type", "text/html; charset=UTF-8");
        bodyAlternatives.addBodyPart(htmlPart);



        // mbp1.setHeader("Content-Language", "fr");
        // add the Multipart to the message
View Full Code Here

        // mbp1.setHeader("Content-Language", "fr");
        // add the Multipart to the message
        Multipart mainMultipart = new MimeMultipart();
        BodyPart body = new MimeBodyPart();
        body.setContent(bodyAlternatives);
        mainMultipart.addBodyPart(body);

        // mainMultipart.addBodyPart(getSerialializerRDFPart(mailModel));

        msg.setContent(mainMultipart);
        log.debug("mesage ready, sending");
View Full Code Here

      }

      part.setContent(sbuf.toString(), getEmailContentType());

      Multipart mp = new MimeMultipart();
      mp.addBodyPart(part);
      msg.setContent(mp);
     
      msg.setSentDate(new Date());
     
      Transport.send(msg);
View Full Code Here

      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);
    }catch(Exception e){
      System.out.println("[Exception]: SendMailEJB.sendMailMessage:");
View Full Code Here

*/

      messageBodyPart.setContent(body, messageContext);

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

      messageBodyPart = new MimeBodyPart();
      HashMap attchmentids            = mailmessage.getAttachFileIDs();

      if ((attchmentids != null) && (attchmentids.size() != 0))
View Full Code Here

          String path          = cvfilevo.getPhysicalFolderVO().getFullPath(null, true) + cvfilevo.getName();

          DataSource source    = new FileDataSource(path);
          messageBodyPart.setDataHandler(new DataHandler(source));
          messageBodyPart.setFileName(name);
          multipart.addBodyPart(messageBodyPart);

        } //end of while loop(itt.hasNext())
      } //end of if statement ((attchmentids != null) && (attchmentids.size() != 0))
      // delete mail from  drafts
      if (mailmessage.getMessageID() != 0)
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.