java.lang.Object
jakarta.mail.Multipart
jakarta.mail.internet.MimeMultipart
org.eclipse.angus.mail.dsn.MultipartReport
A multipart/report message content, as defined in
RFC 3462.
A multipart/report content is a container for mail reports
of any kind, and is most often used to return a delivery
status report or a disposition notification report.
A MultipartReport object is a special type of MimeMultipart object with a restricted set of body parts. A MultipartReport object contains:
- [Required] A human readable text message describing the reason the report was generated.
- [Required] A
Report
object containing the details for why the report was generated. - [Optional] A returned copy of the entire message, or just its headers, which caused the generation of this report.
- Since:
- JavaMail 1.4
-
Field Summary
Fields inherited from class jakarta.mail.internet.MimeMultipart
allowEmpty, complete, ds, ignoreExistingBoundaryParameter, ignoreMissingBoundaryParameter, ignoreMissingEndBoundary, parsed, preamble
Fields inherited from class jakarta.mail.Multipart
contentType, parent, parts, streamProvider
-
Constructor Summary
ConstructorDescriptionConstruct a multipart/report object with no content.MultipartReport
(jakarta.activation.DataSource ds) Constructs a MultipartReport object and its bodyparts from the given DataSource.MultipartReport
(String text, Report report) Construct a multipart/report object with the specified plain text and report type (DeliveryStatus or DispositionNotification) to be returned to the user.MultipartReport
(String text, Report report, InternetHeaders hdr) Construct a multipart/report object with the specified plain text, report, and headers from the original message to be returned to the user.MultipartReport
(String text, Report report, MimeMessage msg) Construct a multipart/report object with the specified plain text, report, and original message to be returned to the user. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addBodyPart
(BodyPart part) Adds a Part to the multipart.void
addBodyPart
(BodyPart part, int index) Adds a BodyPart at positionindex
.Deprecated.use getReport insteadGet the report associated with this multipart/report.Get the original message that is being returned along with this multipart/report.getText()
Get the plain text to be presented to the user, if there is any.Return the body part containing the message to be presented to the user, usually just a text/plain part.void
removeBodyPart
(int index) Remove the part at specified location (starting from 0).boolean
removeBodyPart
(BodyPart part) Remove the specified part from the multipart message.void
setDeliveryStatus
(DeliveryStatus status) Deprecated.use setReport insteadvoid
Set the report associated with this multipart/report.void
Set the original message to be returned as part of the multipart/report.void
setSubType
(String subtype) Set the subtype.void
Set the message to be presented to the user as just a text/plain part containing the specified text.void
Set the body part containing the text to be presented to the user.Methods inherited from class jakarta.mail.internet.MimeMultipart
createInternetHeaders, createMimeBodyPart, createMimeBodyPart, getBodyPart, getBodyPart, getCount, getPreamble, initializeProperties, isComplete, parse, setPreamble, updateHeaders, writeTo
Methods inherited from class jakarta.mail.Multipart
getContentType, getParent, setMultipartDataSource, setParent
-
Field Details
-
constructed
protected boolean constructed
-
-
Constructor Details
-
MultipartReport
Construct a multipart/report object with no content.- Throws:
MessagingException
- for failures
-
MultipartReport
Construct a multipart/report object with the specified plain text and report type (DeliveryStatus or DispositionNotification) to be returned to the user.- Parameters:
text
- the plain textreport
- the Report object- Throws:
MessagingException
- for failures
-
MultipartReport
Construct a multipart/report object with the specified plain text, report, and original message to be returned to the user.- Parameters:
text
- the plain textreport
- the Report objectmsg
- the message this report is about- Throws:
MessagingException
- for failures
-
MultipartReport
Construct a multipart/report object with the specified plain text, report, and headers from the original message to be returned to the user.- Parameters:
text
- the plain textreport
- the Report objecthdr
- the headers of the message this report is about- Throws:
MessagingException
- for failures
-
MultipartReport
Constructs a MultipartReport object and its bodyparts from the given DataSource.- Parameters:
ds
- DataSource, can be a MultipartDataSource- Throws:
MessagingException
- for failures
-
-
Method Details
-
getText
Get the plain text to be presented to the user, if there is any. Rarely, the message may contain only HTML text, or no text at all. If the text body part of this multipart/report object is of type text/plain, or if it is of type multipart/alternative and contains a text/plain part, the text from that part is returned. Otherwise, null is return and thegetTextBodyPart
method may be used to extract the data.- Returns:
- the text
- Throws:
MessagingException
- for failures
-
setText
Set the message to be presented to the user as just a text/plain part containing the specified text.- Parameters:
text
- the text- Throws:
MessagingException
- for failures
-
getTextBodyPart
Return the body part containing the message to be presented to the user, usually just a text/plain part.- Returns:
- the body part containing the text
- Throws:
MessagingException
- for failures
-
setTextBodyPart
Set the body part containing the text to be presented to the user. Usually this a text/plain part, but it might also be a text/html part or a multipart/alternative part containing text/plain and text/html parts. Any type is allowed here but these types are most common.- Parameters:
mbp
- the body part containing the text- Throws:
MessagingException
- for failures
-
getReport
Get the report associated with this multipart/report.- Returns:
- the Report object
- Throws:
MessagingException
- for failures- Since:
- JavaMail 1.4.2
-
setReport
Set the report associated with this multipart/report.- Parameters:
report
- the Report object- Throws:
MessagingException
- for failures- Since:
- JavaMail 1.4.2
-
getDeliveryStatus
Deprecated.use getReport insteadGet the delivery status associated with this multipart/report.- Returns:
- the delivery status
- Throws:
MessagingException
- for failures
-
setDeliveryStatus
Deprecated.use setReport insteadSet the delivery status associated with this multipart/report.- Parameters:
status
- the deliver status- Throws:
MessagingException
- for failures
-
getReturnedMessage
Get the original message that is being returned along with this multipart/report. If no original message is included, null is returned. In some cases only the headers of the original message will be returned as an object of type MessageHeaders.- Returns:
- the returned message
- Throws:
MessagingException
- for failures
-
setReturnedMessage
Set the original message to be returned as part of the multipart/report. If msg is null, any previously set returned message or headers is removed.- Parameters:
msg
- the returned message- Throws:
MessagingException
- for failures
-
setSubType
Set the subtype. Throws MessagingException.- Overrides:
setSubType
in classMimeMultipart
- Parameters:
subtype
- Subtype- Throws:
MessagingException
- always; can't change subtype
-
removeBodyPart
Remove the specified part from the multipart message. Not allowed on a multipart/report object.- Overrides:
removeBodyPart
in classMimeMultipart
- Parameters:
part
- The part to remove- Returns:
- true if part removed, false otherwise
- Throws:
MessagingException
- always
-
removeBodyPart
Remove the part at specified location (starting from 0). Not allowed on a multipart/report object.- Overrides:
removeBodyPart
in classMimeMultipart
- Parameters:
index
- Index of the part to remove- Throws:
MessagingException
- always
-
addBodyPart
Adds a Part to the multipart. Not allowed on a multipart/report object.- Overrides:
addBodyPart
in classMimeMultipart
- Parameters:
part
- The Part to be appended- Throws:
MessagingException
- always
-
addBodyPart
Adds a BodyPart at positionindex
. Not allowed on a multipart/report object.- Overrides:
addBodyPart
in classMimeMultipart
- Parameters:
part
- The BodyPart to be insertedindex
- Location where to insert the part- Throws:
MessagingException
- always
-