com.silverpeas.mailinglist.service.job
Class BetterMimeMessage

java.lang.Object
  extended by javax.mail.Message
      extended by javax.mail.internet.MimeMessage
          extended by com.silverpeas.mailinglist.service.job.BetterMimeMessage
All Implemented Interfaces:
javax.mail.internet.MimePart, javax.mail.Part

public class BetterMimeMessage
extends javax.mail.internet.MimeMessage

Author:
ehugonnet

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.mail.internet.MimeMessage
javax.mail.internet.MimeMessage.RecipientType
 
Field Summary
static String AUTO_SUBMITTED_HEADER
           
static String SPAM_FLAG_HEADER
           
static String SPAM_LEVEL_HEADER
           
 
Fields inherited from class javax.mail.internet.MimeMessage
content, contentStream, dh, flags, headers, modified, saved
 
Fields inherited from class javax.mail.Message
expunged, folder, msgnum, session
 
Fields inherited from interface javax.mail.Part
ATTACHMENT, INLINE
 
Constructor Summary
BetterMimeMessage(javax.mail.internet.MimeMessage message)
           
 
Method Summary
 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, saveChanges, setContent, setContent, setContentID, setContentLanguage, setContentMD5, setDataHandler, setDescription, setDescription, setDisposition, setFileName, setFlags, setFrom, setFrom, setHeader, setRecipients, setRecipients, setReplyTo, setSender, setSentDate, setSubject, setSubject, setText, setText, setText, updateHeaders, updateMessageID, writeTo, writeTo
 
Methods inherited from class javax.mail.Message
addRecipient, getFolder, getMessageNumber, isExpunged, match, setExpunged, setFlag, setMessageNumber, setRecipient
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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
Constructor Detail

BetterMimeMessage

public BetterMimeMessage(javax.mail.internet.MimeMessage message)
                  throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException
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.
See Also:
http://www.ietf.org/rfc/rfc1894.txt

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.
See Also:
http://www.ietf.org/rfc/rfc3462.txt


Copyright © 2016 Silverpeas. All Rights Reserved.