Creates a message.

@param text text data
@param sender Sender client ID.
@param recipients Comma-delimited list of recipient client IDs
@return Message
@throws JMSException if error thrown from creation of object message
497636
public Message createTextMessage(String text, String sender, String recipients) throws JMSException {
        return decorateMessage(getSession().createTextMessage(text), sender, recipients);
    }
1182269
public MimeMessage newMessage( Session session )
    throws MessagingException, EmailException
  {
    MimeMessage message = new MimeMessage( session );

    // populate the addresses and subject.
    populate(message);

    // create the multipart content.
    MimeMultipart containingMultipart = new MimeMultipart(EmailUtil.SUBTYPE_MIXED);

    // create the message multipart content.
    MimeMultipart messageMultipart = new MimeMultipart(EmailUtil.SUBTYPE_ALTERNATIVE);
    containingMultipart.addBodyPart(EmailUtil.newMultipartBodyPart(messageMultipart));

    // create the text part.
    messageMultipart.addBodyPart(EmailUtil.newTextBodyPart(getText()));

    // create the html part.
    MimeMultipart htmlMultipart = new MimeMultipart(EmailUtil.SUBTYPE_RELATED);
    htmlMultipart.addBodyPart(EmailUtil.newHtmlBodyPart(getHtml()));
    messageMultipart.addBodyPart(EmailUtil.newMultipartBodyPart(htmlMultipart));

    /*
    // iterate over the html context, creating new elements for each.
    Iterator htmlAttachmentIterator = htmlAttachmentMap.entrySet().iterator();
    while( htmlAttachmentIterator.hasNext() ) {
      Map.Entry htmlAttachmentEntry = (Map.Entry)htmlAttachmentIterator.next();
      htmlMultipart.addBodyPart(EmailUtil.newHtmlAttachmentPart((URL)htmlAttachmentEntry.getKey(), (String)htmlAttachmentPart.getValue());
    }

    // add the html multipart to the message multipart.
    messageMultipart.addBodyPart(EmailUtil.newMultipartBodyPart(htmlMultipartBodyPart));
    */
  
      
    // create the attachments.
    for( URL attachmentUrl : attachmentUrlSet ) {
      containingMultipart.addBodyPart(EmailUtil.newAttachmentBodyPart(attachmentUrl, null));
    }
    try {
      for( StringAttachment attachment : attachmentStrings ) {
        containingMultipart.addBodyPart(EmailUtil.newAttachmentBodyPart(attachment.getContent(), null, attachment.getMimeType(), attachment.getFilename()));
      }
    } catch (IOException ioe) {
      throw new MessagingException("Unable to create attachment for string.", ioe);
    }

    message.setContent(containingMultipart);

    // save the changes.
    message.saveChanges();

    // return the email.
    return message;
  }
161320
public void send(final Message msg) throws MailException {
		Transport transport = null;
		try {
			if (log.isDebugEnabled()) {
				log.debug("Sending mail message [subject={}, recipients={}]", msg.getSubject(),
						on(", ").join(msg.getAllRecipients()));
			}
			transport = sessionProvider.get().getTransport();
			transport.connect();
			transport.sendMessage(msg, msg.getAllRecipients());
		} catch (MessagingException ex) {
			throw new MailException("Error sending mail message", ex);
		} finally {
			try {
				transport.close();
			} catch (MessagingException ex) {
				log.error(ex.getMessage(), ex);
			}
		}
	}
845258
public void sendTextMessage(String queueName, String text){
        sendTextMessage(queueName, text, DeliveryMode.NON_PERSISTENT, 4, 0);
    }
1113384
@Override
    public void setRecipients(final javax.mail.Message.RecipientType type, final Address[] addresses) throws MessagingException {
        throw new IllegalWriteException("Mock messages are read-only");
    }
265140
public void sendTextMessage(String queueName, String message, int delaySeconds)
            throws NamingException, JMSException, ServiceLocatorException {
        sendTextMessage(null, queueName, message, delaySeconds, null);
    }
806485
@Override
    public TextMessage createTextMessage() throws JMSRuntimeException {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "createTextMessage");

        TextMessage textMessage = null;

        try {
            textMessage = jmsSession.createTextMessage();
        } catch (JMSException jmse) {
            throw (JMSRuntimeException) JmsErrorUtils.getJMS2Exception(jmse, JMSRuntimeException.class);
        } finally {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(this, tc, "createTextMessage", new Object[] { textMessage });
        }

        return textMessage;

    }
1093089
public JsJmsBytesMessage createJmsBytesMessage() throws MessageCreateFailedException {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createJmsBytesMessage");
    JsJmsBytesMessage msg = null;
    try {
      msg = new JsJmsBytesMessageImpl(MfpConstants.CONSTRUCTOR_NO_OP);
    }
    catch (MessageDecodeFailedException e) {
      /* No need to FFDC this as JsMsgObject will already have done so */
      // No FFDC code needed
      throw new MessageCreateFailedException(e);
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createJmsBytesMessage");
    return msg;
  }
470231
public void send(String subject, String body)
  {
    try {
      MimeMessage msg = new MimeMessage(getSession());

      if(_from.length > 0)
        msg.addFrom(_from);
      msg.addRecipients(RecipientType.TO, _to);
      if(subject != null)
        msg.setSubject(subject);
      msg.setContent(body, "text/plain");

      send(msg);
    } catch (RuntimeException e) {
      throw e;
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
440123
@Override
    public void send(Message msg) throws JMSException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "send", msg);

        //Defer straight through to the version with completion listner (which will do all the locking and checking).
        send_internal(msg, null);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "send");
    }
1299168
public Sms to(String name, PhoneNumber number) {
		to(new Recipient(name, number));
		return this;
	}
825025
public static SMTPDeliveryEnvelope[] create(final String sender, final Collection<String> recipients, final SMTPMessage... messages) {
        if (messages == null || messages.length <1 ){
            throw new IllegalArgumentException("At least one MessageInput must be given");
        }
        
        Collection<String> rcpts = Collections.unmodifiableCollection(recipients);
        SMTPDeliveryEnvelope[] transactions = new SMTPDeliveryEnvelope[messages.length];
        for (int i = 0; i < transactions.length; i++) {
            transactions[i] = new SMTPDeliveryEnvelopeImpl(sender, rcpts , messages[i], false);
        }
        return transactions;
    }
209272
public static BaseMessage createMessage(String strMessageClassName, BaseMessageHeader messageHeader, Object data)
    {
       BaseMessage message = null;
       
       if ((strMessageClassName == null)
           && (messageHeader != null))
       {
           strMessageClassName = (String)messageHeader.get(BaseMessageHeader.INTERNAL_MESSAGE_CLASS);
           if ((strMessageClassName == null) || (strMessageClassName.length() == 0))
           {
//?               String strRequestType = (String)messageHeader.get(TrxMessageHeader.MESSAGE_REQUEST_TYPE);
//?               if ((strRequestType == null) || (strRequestType.length() == 0) || (RequestType.MANUAL.equalsIgnoreCase(strRequestType)))
//?                   strMessageClass = ManualMessage.class.getName();
           }
       }
       if ((strMessageClassName != null) && (strMessageClassName.length() > 0))
       {
           strMessageClassName = ClassServiceUtility.getFullClassName(strMessageClassName);
           Object obj = ClassServiceUtility.getClassService().makeObjectFromClassName(strMessageClassName);
           if (obj instanceof BaseMessage)
           {
               message = (BaseMessage)obj;
               message.init(messageHeader, null);
           }
           else if  (obj instanceof MessageRecordDesc)
           {
               message = new TreeMessage(messageHeader, null);
               ((MessageRecordDesc)obj).init(message, null);
           }
       }
       return message;
   }
1089662
@Override
	public Email recipient(Recipient... recipients) {
		this.recipients.addAll(Arrays.asList(recipients));
		return this;
	}
1269230
protected Map<String,Object> createMessageHeaders(MimeMailMessage msg) throws MessagingException, IOException {
        Map<String, Object> headers = new HashMap<>();
        headers.put(CitrusMailMessageHeaders.MAIL_MESSAGE_ID, msg.getMimeMessage().getMessageID());
        headers.put(CitrusMailMessageHeaders.MAIL_FROM, StringUtils.arrayToCommaDelimitedString(msg.getMimeMessage().getFrom()));
        headers.put(CitrusMailMessageHeaders.MAIL_TO, StringUtils.arrayToCommaDelimitedString((msg.getMimeMessage().getRecipients(javax.mail.Message.RecipientType.TO))));
        headers.put(CitrusMailMessageHeaders.MAIL_CC, StringUtils.arrayToCommaDelimitedString((msg.getMimeMessage().getRecipients(javax.mail.Message.RecipientType.CC))));
        headers.put(CitrusMailMessageHeaders.MAIL_BCC, StringUtils.arrayToCommaDelimitedString((msg.getMimeMessage().getRecipients(javax.mail.Message.RecipientType.BCC))));
        headers.put(CitrusMailMessageHeaders.MAIL_REPLY_TO, StringUtils.arrayToCommaDelimitedString((msg.getMimeMessage().getReplyTo())));
        headers.put(CitrusMailMessageHeaders.MAIL_DATE, msg.getMimeMessage().getSentDate() != null ? dateFormat.format(msg.getMimeMessage().getSentDate()) : null);
        headers.put(CitrusMailMessageHeaders.MAIL_SUBJECT, msg.getMimeMessage().getSubject());
        headers.put(CitrusMailMessageHeaders.MAIL_CONTENT_TYPE, parseContentType(msg.getMimeMessage().getContentType()));

        return headers;
    }
42091
@Override
    public StreamMessage createStreamMessage() throws JMSRuntimeException {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "createStreamMessage");

        StreamMessage streamMessage = null;

        try {
            streamMessage = jmsSession.createStreamMessage();
        } catch (JMSException jmse) {
            throw (JMSRuntimeException) JmsErrorUtils.getJMS2Exception(jmse, JMSRuntimeException.class);
        } finally {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(this, tc, "createStreamMessage", new Object[] { streamMessage });
        }

        return streamMessage;

    }
394772
public void send(String destName, Message msg) throws MessagingException {
        JMSDestination jmsDest = getJMSDestination(destName);

        // Make sure we have a message producer created for this destination
        setupProducer(jmsDest);

        // Send the message for this destination
        try {
            jmsDest.producer.send(msg);
        } catch (JMSException e) {
            throw new MessagingException(e.getMessage(), e);
        }

        if(logger.isDebugEnabled()) {
            logger.debug("send() - message sent to destination " + destName);
        }
    }