public abstract class AbstractMimeMessage extends Object implements MimeMessage
MimeMessage
interface. Contains convenient default implementations.Constructor and Description |
---|
AbstractMimeMessage() |
Modifier and Type | Method and Description |
---|---|
Attachment |
addAttachment(String contentId,
File file)
Add an attachment to the message, taking the content from a
File . |
Attachment |
addAttachment(String contentId,
org.springframework.core.io.InputStreamSource inputStreamSource,
String contentType)
Add an attachment to the message, taking the content from an
InputStreamSource . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addAttachment, convertToXopPackage, getAttachment, getAttachments, isXopPackage
getPayloadResult, getPayloadSource, writeTo
public final Attachment addAttachment(String contentId, File file) throws AttachmentException
MimeMessage
File
.
The content type will be determined by the name of the given content file. Do not use this for temporary files with arbitrary filenames (possibly ending in ".tmp" or the like)!
addAttachment
in interface MimeMessage
contentId
- the content Id of the attachmentfile
- the file to take the content fromAttachmentException
- in case of errorspublic final Attachment addAttachment(String contentId, org.springframework.core.io.InputStreamSource inputStreamSource, String contentType)
MimeMessage
InputStreamSource
.
Note that the stream returned by the source needs to be a fresh one on each call, as underlying
implementations can invoke InputStreamSource.getInputStream()
multiple times.
addAttachment
in interface MimeMessage
contentId
- the content Id of the attachmentinputStreamSource
- the resource to take the content from (all of Spring's Resource implementations can be
passed in here)contentType
- the content type to use for the elementResource
Copyright © 2020 Pivotal Software. All rights reserved.