|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jasen.util.MimeUtils
General Mime utilities.
Field Summary | |
static String[] |
ATTACHMENT_DISPOSITIONS
|
static int |
FORGERY_CONFIRMED
Confirmed forgery |
static int |
FORGERY_REJECTED
Confirmed authentic |
static int |
FORGERY_UNDETERMINED
Undetermined (test not yet performed) |
static int |
FORGERY_UNKNOWN
Forgery status could not be determined with absolute certainty |
Constructor Summary | |
MimeUtils()
|
Method Summary | |
static List |
getAllAttachmentParts(List parts)
Gets all parts which can be considered an attachment. |
static javax.mail.Header[] |
getAllHeaders(javax.mail.internet.MimeMessage message)
|
static String |
getDomainFromAddress(String emailAddress)
Returns the domain component of an email address |
static javax.mail.Part |
getFirstPartFromList(List parts,
String contentType,
String disposition)
|
static List |
getMultiplePartsFromList(List parts,
String contentType,
String[] dispositions)
Gets the parts which match any of the dispositions |
static Object |
getPartContent(javax.mail.Part part)
|
static void |
getParts(List parts,
javax.mail.Part p)
|
static void |
getParts(List parts,
javax.mail.Part p,
String contentType,
String disposition)
Gets the parts from the MimeMessage Use null disposition to ignore |
static List |
getPartsFromList(List parts,
String contentType,
String disposition)
|
static List |
getSubMessagePartsFromList(List parts)
Gets a list of all parts which are themselves MimeMessages |
static List |
getUnknownPartsFromList(List parts)
Gets all parts which are unknown. |
static boolean |
isAttachment(String disposition)
|
static int |
isForgery(InetAddressResolver resolver,
javax.mail.internet.MimeMessage message,
String senderAddress,
ReceivedHeaderParser parser)
Determines if the loaded message is a forgery. |
static boolean |
isValidAddress(String address)
|
static javax.mail.internet.InternetAddress |
toInternetAddress(javax.mail.Address address)
Converts an Address object to an Internet Address with strict address parsing |
static javax.mail.internet.InternetAddress |
toInternetAddress(javax.mail.Address address,
boolean strict)
Converts an Address object to an Internet Address |
static boolean |
verifySenderAddress(DNSResolver dresolver,
InetAddressResolver iresolver,
ReceivedHeaderParser parser,
String receivedHeaderLine,
String senderAddress)
Verifies the given sender address against the information in the last (most recent) received header line Specifically, this does the following: get domain of sender get IP address of last (most recent) MTA get hostname of last (most recent) MTA if (MTA IP Address resolves to MTA hostname) then use MTA hostname for MX IP records else use MTA IP Address get MX records for sender domain if(at least 1 MX record IP matches MTA IP) then valid |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int FORGERY_UNDETERMINED
public static final int FORGERY_CONFIRMED
public static final int FORGERY_REJECTED
public static final int FORGERY_UNKNOWN
public static String[] ATTACHMENT_DISPOSITIONS
Constructor Detail |
public MimeUtils()
Method Detail |
public static javax.mail.Header[] getAllHeaders(javax.mail.internet.MimeMessage message) throws javax.mail.MessagingException
javax.mail.MessagingException
public static boolean isValidAddress(String address)
public static boolean verifySenderAddress(DNSResolver dresolver, InetAddressResolver iresolver, ReceivedHeaderParser parser, String receivedHeaderLine, String senderAddress) throws JasenParseException, UnknownHostException, DNSException
parser
- The parser to use on the header linereceivedHeaderLine
- The last (most recent) received header linesenderAddress
- The From address (NOT the envelope address)
JasenParseException
UnknownHostException
DNSException
public static javax.mail.internet.InternetAddress toInternetAddress(javax.mail.Address address) throws javax.mail.internet.AddressException
address
-
javax.mail.internet.AddressException
public static javax.mail.internet.InternetAddress toInternetAddress(javax.mail.Address address, boolean strict) throws javax.mail.internet.AddressException
address
- strict
- If true, address parsing is strict
javax.mail.internet.AddressException
public static int isForgery(InetAddressResolver resolver, javax.mail.internet.MimeMessage message, String senderAddress, ReceivedHeaderParser parser) throws javax.mail.MessagingException, JasenParseException
resolver
- The resolver used to resolve InetAddressesmessage
- The MimeMessage to testsenderAddress
- The envelope senderparser
- The parser to use to parse the "Received" header(s)
javax.mail.MessagingException
CacheException
JasenParseException
public static String getDomainFromAddress(String emailAddress)
emailAddress
-
public static boolean isAttachment(String disposition)
public static void getParts(List parts, javax.mail.Part p) throws javax.mail.MessagingException, IOException
javax.mail.MessagingException
IOException
public static void getParts(List parts, javax.mail.Part p, String contentType, String disposition) throws javax.mail.MessagingException, IOException
parts
- A new list to hold the partsp
- The current PartcontentType
- If specified, returns only parts matching the given content type. Use null to ignoredisposition
- If specified, returns only parts matching the given disposition. Use null to ignore
javax.mail.MessagingException
IOException
public static List getMultiplePartsFromList(List parts, String contentType, String[] dispositions) throws IOException, javax.mail.MessagingException
parts
- A list of partscontentType
- The content type requireddispositions
- The content dispositions required
IOException
javax.mail.MessagingException
public static List getSubMessagePartsFromList(List parts) throws IOException, javax.mail.MessagingException
parts
-
IOException
javax.mail.MessagingException
public static List getUnknownPartsFromList(List parts) throws IOException, javax.mail.MessagingException
parts
-
IOException
javax.mail.MessagingException
public static List getAllAttachmentParts(List parts) throws IOException, javax.mail.MessagingException
parts
-
IOException
javax.mail.MessagingException
public static javax.mail.Part getFirstPartFromList(List parts, String contentType, String disposition) throws javax.mail.MessagingException, IOException
javax.mail.MessagingException
IOException
public static List getPartsFromList(List parts, String contentType, String disposition) throws javax.mail.MessagingException, IOException
javax.mail.MessagingException
IOException
public static Object getPartContent(javax.mail.Part part) throws IOException, javax.mail.MessagingException
IOException
javax.mail.MessagingException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |