Package javax.mail.internet

Examples of javax.mail.internet.MimeMessage.addRecipients()


        try {
            // Add all <to>
            for (String toStr : to) {
                toAddrs.add(new InternetAddress(toStr.trim()));
            }
            message.addRecipients(RecipientType.TO, toAddrs.toArray(new InternetAddress[0]));

            // Add all <cc>
            for (String ccStr : cc) {
                ccAddrs.add(new InternetAddress(ccStr.trim()));
            }
View Full Code Here


            // Add all <cc>
            for (String ccStr : cc) {
                ccAddrs.add(new InternetAddress(ccStr.trim()));
            }
            message.addRecipients(RecipientType.CC, ccAddrs.toArray(new InternetAddress[0]));

            // Set subject, and plain-text body.
            message.setSubject(subject);
            message.setContent(body, "text/plain");
        } catch (AddressException e) {
View Full Code Here

                            String soapAction)
            throws MessagingException {
        log.info("SENDING message from " + from + " to " + to);
        MimeMessage msg = new MimeMessage(session);
        msg.setHeader("transport.mail.soapaction", soapAction);
        msg.addRecipients(Message.RecipientType.TO, to);
        msg.setSubject(subject);
        msg.setText(content);
        Transport.send(msg);
    }
View Full Code Here

    // Building MimeMessage
    MimeMessage mimeMessage = new MimeMessage(session);
    mimeMessage.setSubject(subject);
    mimeMessage.setFrom(new InternetAddress(from));
    mimeMessage.addRecipients(Message.RecipientType.TO,
        InternetAddress.parse(recipients, false));

    // -- Create a new message --
    BodyPart msg = new MimeBodyPart();
    msg.setDataHandler(new DataHandler(new ByteArrayDataSource(htmlBody,
View Full Code Here

        log.debug("setReplyTo "+replyTo);
        if (MailUtil.matches(replyTo)) {
          msg.setReplyTo(new InternetAddress[]{new InternetAddress(replyTo)});
        }
      }
      msg.addRecipients(Message.RecipientType.TO,
          InternetAddress.parse(recipients, false));
     
      return msg;
    }
   
View Full Code Here

    Session session = Session.getInstance(this.mailerProperties, this.authenticator);
    try {
      MimeMessage message = new MimeMessage(session);
      message.setFrom(new InternetAddress(this.automatedSender));
      message.addRecipients(Message.RecipientType.TO, recipients.toArray(new InternetAddress[recipients.size()]));

      message.setSubject(subject);
      message.setContent(messageBody, "text/plain");

      Transport.send(message);
View Full Code Here

        log.info("SENDING message from " + from + " to " + to);

        MimeMessage msg = new MimeMessage(session);

        msg.setHeader("transport.mail.soapaction", soapAction);
        msg.addRecipients(Message.RecipientType.TO, to);
        msg.setSubject(subject);
        msg.setText(content);
        Transport.send(msg);
    }
View Full Code Here

            MimeMessage mail = new MimeMessage(session);
            mail.setFrom(new InternetAddress(sendFrom));
            mail.setSubject(subject);
            mail.setHeader("X-Mailer", "Apache OFBiz, The Apache Open For Business Project");
            mail.setSentDate(new Date());
            mail.addRecipients(Message.RecipientType.TO, sendTo);

            if (UtilValidate.isNotEmpty(sendCc)) {
                mail.addRecipients(Message.RecipientType.CC, sendCc);
            }
            if (UtilValidate.isNotEmpty(sendBcc)) {
View Full Code Here

            mail.setHeader("X-Mailer", "Apache OFBiz, The Apache Open For Business Project");
            mail.setSentDate(new Date());
            mail.addRecipients(Message.RecipientType.TO, sendTo);

            if (UtilValidate.isNotEmpty(sendCc)) {
                mail.addRecipients(Message.RecipientType.CC, sendCc);
            }
            if (UtilValidate.isNotEmpty(sendBcc)) {
                mail.addRecipients(Message.RecipientType.BCC, sendBcc);
            }
View Full Code Here

            if (UtilValidate.isNotEmpty(sendCc)) {
                mail.addRecipients(Message.RecipientType.CC, sendCc);
            }
            if (UtilValidate.isNotEmpty(sendBcc)) {
                mail.addRecipients(Message.RecipientType.BCC, sendBcc);
            }

            if (UtilValidate.isNotEmpty(bodyParts)) {
                // check for multipart message (with attachments)
                // BodyParts contain a list of Maps items containing content(String) and type(String) of the attachement
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.