net.spamcomplaint.mail
Class MimeMessageParser
java.lang.Object
net.spamcomplaint.mail.MimeMessageParser
public class MimeMessageParser
- extends java.lang.Object
- Author:
- jcalfee
- See Also:
http://www.w3.org/Protocols/rfc1341/7_2_Multipart.html
|
Method Summary |
static java.util.Date |
_getDate(javax.mail.internet.MimeMessage msg)
|
static java.lang.String |
byHost(java.lang.String receivedLine)
|
static java.lang.String |
contentToString(java.lang.Object content)
|
java.lang.String |
digout()
Get The Hash value as a Hex-String. |
static java.lang.StringBuffer |
getAllHeaders(java.util.Enumeration msgEnum)
|
static java.util.Date |
getDate(javax.mail.internet.MimeMessage msg)
|
static java.lang.String |
getDateString(java.lang.String text)
|
static javax.mail.internet.MimeMessage |
getMimeMessage(java.lang.String msgText)
|
static java.lang.String |
getSpamComplaintIP(java.lang.String[] received,
int lastTrustedIp)
|
static java.lang.String |
getSpamComplaintIP(java.lang.String msgText,
ReceivedAnalysis ra)
|
java.lang.String |
getUnique_SHA1(java.util.Enumeration mimeHeaders)
|
static java.util.Date |
parseDate(java.lang.String dateStr)
Attempts to parse a date using first the standard MIME date format, and fails over
to alternative formats. |
static java.lang.String |
primaryDomain(java.lang.String domain)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
dateFormat_1
public static java.text.SimpleDateFormat dateFormat_1
dateFormat_2
public static java.text.SimpleDateFormat dateFormat_2
dateFormat_3
public static java.text.SimpleDateFormat dateFormat_3
MimeMessageParser
public MimeMessageParser()
digout
public java.lang.String digout()
- Get The Hash value as a Hex-String. Calling this method resets the object's state to initial state.
- Returns:
- String representing the Hashvalue in hexadecimal format.
getMimeMessage
public static javax.mail.internet.MimeMessage getMimeMessage(java.lang.String msgText)
throws javax.mail.MessagingException
- Throws:
javax.mail.MessagingException
getUnique_SHA1
public java.lang.String getUnique_SHA1(java.util.Enumeration mimeHeaders)
throws java.security.NoSuchAlgorithmException
- Parameters:
mimeMsg -
- Returns:
- hex SHA1 of key fields in the header { received, from, to }
- Throws:
javax.mail.MessagingException
java.security.NoSuchAlgorithmException - if SHA1 is not available
byHost
public static java.lang.String byHost(java.lang.String receivedLine)
getSpamComplaintIP
public static java.lang.String getSpamComplaintIP(java.lang.String[] received,
int lastTrustedIp)
getSpamComplaintIP
public static java.lang.String getSpamComplaintIP(java.lang.String msgText,
ReceivedAnalysis ra)
throws javax.mail.MessagingException,
TrustedNodeException
- Parameters:
msgText - ra -
- Returns:
- Sender IP address, this could be null (undetermined)
- Throws:
javax.mail.MessagingException
TrustedNodeException
contentToString
public static java.lang.String contentToString(java.lang.Object content)
throws java.io.IOException
- Throws:
java.io.IOException
parseDate
public static java.util.Date parseDate(java.lang.String dateStr)
throws java.text.ParseException
- Attempts to parse a date using first the standard MIME date format, and fails over
to alternative formats.
- Parameters:
dateStr -
- Returns:
- Date represented by dateStr
- Throws:
java.text.ParseException
getDateString
public static java.lang.String getDateString(java.lang.String text)
- Parameters:
text - with a date string at the end of the line
- Returns:
- Fri, 23 Mar 2007 10:45:44 -0500 or null
getDate
public static java.util.Date getDate(javax.mail.internet.MimeMessage msg)
- Parameters:
MimeMessage, - date will be extracted from the headers
- Returns:
- "Date" property from header or from received line from
furthest mail servers to the closest mail server. Null is returned
if a date could not be found or parsed anywhere.
- Throws:
javax.mail.MessagingException
_getDate
public static java.util.Date _getDate(javax.mail.internet.MimeMessage msg)
throws javax.mail.MessagingException
- Throws:
javax.mail.MessagingException
getAllHeaders
public static java.lang.StringBuffer getAllHeaders(java.util.Enumeration msgEnum)
primaryDomain
public static java.lang.String primaryDomain(java.lang.String domain)
- Parameters:
one - like these:
a453.domain.example.com, 61.236.8.142, 127.0.0.1
- Returns:
- one of the following for a given parameter:
example.com, 61.236.8.142, internal_ip
Copyright © 2008. All Rights Reserved.