/** * Add the given addresses to the specified recipient type. * * @param type Recipient type * @param addresses Addresses * @exception AddressException if the attempt to parse the * addresses String fails * @exception IllegalWriteException if the underlying * implementation does not support modification * of existing values * @exception IllegalStateException if this message is * obtained from a READ_ONLY folder. * @exception MessagingException for other failures * @since JavaMail 1.2 */ public void addRecipients(Message.RecipientType type, String addresses) throws MessagingException { if (type == RecipientType.NEWSGROUPS) { if (addresses != null && addresses.length() != 0) addHeader("Newsgroups", addresses); } else addAddressHeader(getHeaderName(type), InternetAddress.parse(addresses)); }
/** * Add the given addresses to the specified recipient type. * * @param type Recipient type * @param addresses Addresses * @exception AddressException if the attempt to parse the * addresses String fails * @exception IllegalWriteException if the underlying * implementation does not support modification * of existing values * @exception IllegalStateException if this message is * obtained from a READ_ONLY folder. * @exception MessagingException for other failures * @since JavaMail 1.2 */ public void addRecipients(Message.RecipientType type, String addresses) throws MessagingException { if (type == RecipientType.NEWSGROUPS) { if (addresses != null && addresses.length() != 0) addHeader("Newsgroups", addresses); } else addAddressHeader(getHeaderName(type), InternetAddress.parse(addresses)); }
/** * Add the given addresses to the specified recipient type. * * @param type Recipient type * @param addresses Addresses * @exception IllegalWriteException if the underlying * implementation does not support modification * of existing values * @exception IllegalStateException if this message is * obtained from a READ_ONLY folder. * @exception MessagingException for other failures */ public void addRecipients(Message.RecipientType type, Address[] addresses) throws MessagingException { if (type == RecipientType.NEWSGROUPS) { String s = NewsAddress.toString(addresses); if (s != null) addHeader("Newsgroups", s); } else addAddressHeader(getHeaderName(type), addresses); }
/** * Add the given addresses to the specified recipient type. * * @param type Recipient type * @param addresses Addresses * @exception IllegalWriteException if the underlying * implementation does not support modification * of existing values * @exception IllegalStateException if this message is * obtained from a READ_ONLY folder. * @exception MessagingException for other failures */ @Override public void addRecipients(Message.RecipientType type, Address[] addresses) throws MessagingException { if (type == RecipientType.NEWSGROUPS) { String s = NewsAddress.toString(addresses); if (s != null) addHeader("Newsgroups", s); } else addAddressHeader(getHeaderName(type), addresses); }
this.message.addHeader(entry.getKey(), foldedValue);
email.setText(body); email.setSentDate(new Date()); email.addHeader("X-FHIR-Subscription", subscriptionId); } catch (MessagingException e) { throw new InternalErrorException("Failed to create email message", e);
/** * Add a set of addresses to the existing From header. * * @param addresses The list to add. * * @exception MessagingException */ public void addFrom(Address[] addresses) throws MessagingException { addHeader("From", addresses); }
/** * Add a set of addresses to the existing From header. * * @param addresses The list to add. * * @exception MessagingException */ public void addFrom(Address[] addresses) throws MessagingException { addHeader("From", addresses); }
/** * Add a list of addresses to a target recipient list. * * @param type The target recipient type. * @param address An array of addresses to add. * * @exception MessagingException */ public void addRecipients(Message.RecipientType type, Address[] address) throws MessagingException { addHeader(getHeaderForRecipientType(type), address); }
/** * @see javax.mail.Part#addHeader(java.lang.String, java.lang.String) */ public void addHeader(String name, String value) throws MessagingException { getWrappedMessageForWriting().addHeader(name, value); }
private void restoreHeaders(MimeMessage mimeMessage, Map<String, List<String>> savedHeaders) throws MessagingException { for (Map.Entry<String, List<String>> header: savedHeaders.entrySet()) { String name = header.getKey(); mimeMessage.removeHeader(name); for (String value: header.getValue()) { mimeMessage.addHeader(name, value); } } }
@Override public void addRequestHeader(String name, String value) throws IOException { try { requestMessage.addHeader(name, value); if (TransportConstants.HEADER_CONTENT_TYPE.equals(name)) { requestContentType = value; } } catch (MessagingException ex) { throw new MailTransportException(ex); } }
/** * Add an address to a target recipient list by string name. * * @param type The target header type. * @param address The address to add. * * @exception MessagingException */ public void addRecipients(Message.RecipientType type, String address) throws MessagingException { addHeader(getHeaderForRecipientType(type), address); }
private void addAddressHeader(String name, Address[] addresses) throws MessagingException { String s = InternetAddress.toString(addresses); if (s == null) return; addHeader(name, s); }
/** * {@inheritDoc} */ public void addHeader(final String s, final String s1) throws MessagingException { super.addHeader(s, s1); updateHeaders(false); }
@Override public void addRequestHeader(String name, String value) throws IOException { try { requestMessage.addHeader(name, value); if (TransportConstants.HEADER_CONTENT_TYPE.equals(name)) { requestContentType = value; } } catch (MessagingException ex) { throw new MailTransportException(ex); } }
/** * Add a list of addresses to a target recipient list. * * @param type The target recipient type. * @param address An array of addresses to add. * * @exception MessagingException */ public void addRecipients(Message.RecipientType type, Address[] address) throws MessagingException { addHeader(getHeaderForRecipientType(type), address); }
private void setJmapMessageIdAsHeader(MimeMessage mimeMessage, MessageId messageId) { LOGGER.debug("Adding header {}:{}", X_JAMES_MDN_JMAP_MESSAGE_ID, messageId.serialize()); try { mimeMessage.addHeader(X_JAMES_MDN_JMAP_MESSAGE_ID, messageId.serialize()); } catch (MessagingException e) { LOGGER.error("unable to add " + X_JAMES_MDN_JMAP_MESSAGE_ID + " header to message", e); } }
private void addIfPresent(MimeMessage mimeMessage, String headerName, Property property) { if (property != null) { try { mimeMessage.addHeader(headerName, property.getValue()); } catch (MessagingException e) { LOGGER.error("Could not add header {} with value {}", headerName, property.getValue(), e); } } } }