/** * A constructor that creates a MailImpl with the specified name, * sender, recipients, and MimeMessage. * * @param name the name of the MailImpl * @param sender the sender for this MailImpl * @param recipients the collection of recipients of this MailImpl * @param message the MimeMessage associated with this MailImpl */ public MailImpl(String name, MailAddress sender, Collection recipients, MimeMessage message) throws MessagingException { this(name, sender, recipients); this.setMessage(new MimeMessageCopyOnWriteProxy(message)); }
/** * @see java.lang.Object#hashCode() */ public int hashCode() { return getWrappedMessage().hashCode(); }
/** * @see javax.mail.Message#setFrom(javax.mail.Address) */ public void setFrom(Address address) throws MessagingException { getWrappedMessageForWriting().setFrom(address); }
/** * Return the full site of an mimeMessage * * @return size of full message including headers * @throws MessagingException if a problem occours while computing the message size */ public static long getMessageSize(MimeMessage message) throws MessagingException { //If we have a MimeMessageWrapper, then we can ask it for just the // message size and skip calculating it long size = -1; if (message instanceof MimeMessageWrapper) { MimeMessageWrapper wrapper = (MimeMessageWrapper) message; size = wrapper.getMessageSize(); } else if (message instanceof MimeMessageCopyOnWriteProxy) { MimeMessageCopyOnWriteProxy wrapper = (MimeMessageCopyOnWriteProxy) message; size = wrapper.getMessageSize(); } if (size == -1) { size = calculateMessageSize(message); } return size; }
/** * @see java.lang.Object#toString() */ public String toString() { return getWrappedMessage().toString(); }
mc.setMessage(new MimeMessageCopyOnWriteProxy(source));
/** * @see javax.mail.Message#setSubject(java.lang.String) */ public void setSubject(String subject) throws MessagingException { getWrappedMessageForWriting().setSubject(subject); }
/** * @see java.lang.Object#equals(java.lang.Object) */ public boolean equals(Object arg0) { return getWrappedMessage().equals(arg0); }
mc.setMessage(new MimeMessageCopyOnWriteProxy(source));
/** * @see javax.mail.Part#setContent(java.lang.Object, java.lang.String) */ public void setContent(Object o, String type) throws MessagingException { getWrappedMessageForWriting().setContent(o, type); }
/** * Rewritten for optimization purposes */ public void writeTo(OutputStream os) throws IOException, MessagingException { getWrappedMessage().writeTo(os); }
/** * A constructor that creates a MailImpl with the specified name, * sender, recipients, and message data. * * @param name the name of the MailImpl * @param sender the sender for this MailImpl * @param recipients the collection of recipients of this MailImpl * @param messageIn a stream containing the message source */ public MailImpl(String name, MailAddress sender, Collection recipients, InputStream messageIn) throws MessagingException { this(name, sender, recipients); MimeMessageSource source = new MimeMessageInputStreamSource(name, messageIn); // if MimeMessageCopyOnWriteProxy throws an error in the constructor we // have to manually care disposing our source. try { this.setMessage(new MimeMessageCopyOnWriteProxy(source)); } catch (MessagingException e) { LifecycleUtil.dispose(source); throw e; } }
/** * @see javax.mail.internet.MimeMessage#setRecipients(javax.mail.Message.RecipientType, java.lang.String) */ public void setRecipients(Message.RecipientType type, String addresses) throws MessagingException { getWrappedMessageForWriting().setRecipients(type, addresses); }
/** * @see javax.mail.Message#getSentDate() */ public Date getSentDate() throws MessagingException { return getWrappedMessage().getSentDate(); }
mimeMessageCopyOnWriteProxy = new MimeMessageCopyOnWriteProxy(mmiss); mail.setMessage(mimeMessageCopyOnWriteProxy);
/** * @see javax.mail.Part#setContent(javax.mail.Multipart) */ public void setContent(Multipart mp) throws MessagingException { getWrappedMessageForWriting().setContent(mp); }
/** * @see javax.mail.Part#getLineCount() */ public int getLineCount() throws MessagingException { return getWrappedMessage().getLineCount(); }
mimeMessageCopyOnWriteProxy = new MimeMessageCopyOnWriteProxy(mmiss); mail.setMessage(mimeMessageCopyOnWriteProxy);
/** * @see javax.mail.Message#setFrom() */ public void setFrom() throws MessagingException { getWrappedMessageForWriting().setFrom(); }
/** * @see javax.mail.internet.MimeMessage#getMessageID() */ public String getMessageID() throws MessagingException { return getWrappedMessage().getMessageID(); }