Class BetterMimeMessage
- java.lang.Object
-
- javax.mail.Message
-
- javax.mail.internet.MimeMessage
-
- org.silverpeas.components.mailinglist.service.job.BetterMimeMessage
-
- All Implemented Interfaces:
javax.mail.internet.MimePart
,javax.mail.Part
public class BetterMimeMessage extends javax.mail.internet.MimeMessage
- Author:
- ehugonnet
-
-
Field Summary
Fields Modifier and Type Field Description static String
AUTO_SUBMITTED_HEADER
static String
SPAM_FLAG_HEADER
static String
SPAM_LEVEL_HEADER
-
Constructor Summary
Constructors Constructor Description BetterMimeMessage(javax.mail.internet.MimeMessage message)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description float
getSpamLevel()
Returning the content of the X-Spam-Score header.protected boolean
isAutomaticMessage()
boolean
isBounced()
Indicates if this email is automatic ou bounced .protected boolean
isDeliveryStatus(String contentType)
Indicates if the corresponding MimeType is a content-type for delivery status notifications (DSNs).protected boolean
isMessageReport(String contentType)
A multipart/report message content, as defined in RFC 3462.protected boolean
isNotification(String contentType)
boolean
isSpam()
Looking for a X-Spam-Flag header in the message.-
Methods inherited from class javax.mail.internet.MimeMessage
addFrom, addHeader, addHeaderLine, addRecipients, addRecipients, createInternetHeaders, createMimeMessage, getAllHeaderLines, getAllHeaders, getAllRecipients, getContent, getContentID, getContentLanguage, getContentMD5, getContentStream, getContentType, getDataHandler, getDescription, getDisposition, getEncoding, getFileName, getFlags, getFrom, getHeader, getHeader, getInputStream, getLineCount, getMatchingHeaderLines, getMatchingHeaders, getMessageID, getNonMatchingHeaderLines, getNonMatchingHeaders, getRawInputStream, getReceivedDate, getRecipients, getReplyTo, getSender, getSentDate, getSize, getSubject, isMimeType, isSet, parse, removeHeader, reply, reply, saveChanges, setContent, setContent, setContentID, setContentLanguage, setContentMD5, setDataHandler, setDescription, setDescription, setDisposition, setFileName, setFlags, setFrom, setFrom, setFrom, setHeader, setRecipients, setRecipients, setReplyTo, setSender, setSentDate, setSubject, setSubject, setText, setText, setText, updateHeaders, updateMessageID, writeTo, writeTo
-
-
-
-
Field Detail
-
SPAM_FLAG_HEADER
public static final String SPAM_FLAG_HEADER
- See Also:
- Constant Field Values
-
SPAM_LEVEL_HEADER
public static final String SPAM_LEVEL_HEADER
- See Also:
- Constant Field Values
-
AUTO_SUBMITTED_HEADER
public static final String AUTO_SUBMITTED_HEADER
- See Also:
- Constant Field Values
-
-
Method Detail
-
isSpam
public boolean isSpam() throws javax.mail.MessagingException
Looking for a X-Spam-Flag header in the message.- Returns:
- true if the flag is set to YES, false otherwise.
- Throws:
javax.mail.MessagingException
-
getSpamLevel
public float getSpamLevel() throws javax.mail.MessagingException
Returning the content of the X-Spam-Score header.- Returns:
- the content of the X-Spam-Score header.
- Throws:
javax.mail.MessagingException
-
isBounced
public boolean isBounced() throws IOException, javax.mail.MessagingException
Indicates if this email is automatic ou bounced .- Returns:
- true if this email is automatic ou bounced - false otherwise.
- Throws:
IOException
javax.mail.MessagingException
-
isAutomaticMessage
protected boolean isAutomaticMessage() throws javax.mail.MessagingException
- Throws:
javax.mail.MessagingException
-
isNotification
protected boolean isNotification(String contentType)
-
isDeliveryStatus
protected boolean isDeliveryStatus(String contentType)
Indicates if the corresponding MimeType is a content-type for delivery status notifications (DSNs). A DSN can be used to notify the sender of a message of any of several conditions: failed delivery, delayed delivery, successful delivery, or the gatewaying of a message into an environment that may not support DSNs. The "message/delivery-status" content-type defined herein is intended for use within the framework of the "multipart/report" content type defined. Cf. RFC 1894- Parameters:
contentType
- the content-type for the mail part.- Returns:
- true if it is a content-type for delivery status.
-
isMessageReport
protected boolean isMessageReport(String contentType)
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.- Parameters:
contentType
- the content-type for the mail part.- Returns:
- true if it is a content-type for delivery status.
-
-