Package com.icegreen.greenmail.util
Class GreenMailUtil
java.lang.Object
com.icegreen.greenmail.util.GreenMailUtil
- Since:
- Jan 29, 2006 Changed newMimeMessage(String param) for UTF-8 support.
- Version:
- $Id: $
- Author:
- Wael Chatila
-
Method Summary
Modifier and TypeMethodDescriptionstatic IdRange[]convertUidsToIdRangeArray(List<Long> uids) static voidcopyStream(InputStream src, OutputStream dest) Writes the content of an input stream to an output streamstatic StringgetAddressList(javax.mail.Address[] addresses) static StringgetBody(javax.mail.Part msg) static byte[]getBodyAsBytes(javax.mail.Part msg) static byte[]getHeaderAsBytes(javax.mail.Part part) static StringgetHeaders(javax.mail.Part msg) static intgetLineCount(String str) static javax.mail.SessiongetSession(ServerSetup setup) static StringgetWholeMessage(javax.mail.Part msg) static booleanhasNonTextAttachments(javax.mail.Part m) static StringidRangesToString(IdRange[] idRanges) static StringidRangeToString(IdRange idRange) static GreenMailUtilinstance()static javax.mail.internet.MimeMessagenewMimeMessage(InputStream inputStream) Convenience method which creates a newMimeMessagefrom an input streamstatic javax.mail.internet.MimeMessagenewMimeMessage(String mailString) Convenience method which creates a newMimeMessagefrom a stringstatic Stringrandom()Generates a random generated password consisting of letters and digits with a length variable between 5 and 8 characters long.static Stringrandom(int nbrOfLetters) static voidsendAttachmentEmail(String to, String from, String subject, String msg, byte[] attachment, String contentType, String filename, String description, ServerSetup setup) static voidsendTextEmail(String to, String from, String subject, String msg, ServerSetup setup) static voidsendTextEmailSecureTest(String to, String from, String subject, String msg) static voidsendTextEmailTest(String to, String from, String subject, String msg) static StringtoString(javax.mail.Part msg) static StringuidsToRangeString(List<Long> uids)
-
Method Details
-
instance
-
copyStream
Writes the content of an input stream to an output stream- Throws:
IOException
-
newMimeMessage
Convenience method which creates a newMimeMessagefrom an input stream -
newMimeMessage
public static javax.mail.internet.MimeMessage newMimeMessage(String mailString) throws javax.mail.MessagingException Convenience method which creates a newMimeMessagefrom a string- Throws:
javax.mail.MessagingException
-
hasNonTextAttachments
public static boolean hasNonTextAttachments(javax.mail.Part m) -
getLineCount
- Returns:
- Returns the number of lines in any string
-
getBody
- Returns:
- The content of an email (or a Part)
-
getHeaders
- Returns:
- The headers of an email (or a Part)
-
getWholeMessage
- Returns:
- The both header and body for an email (or a Part)
-
getBodyAsBytes
public static byte[] getBodyAsBytes(javax.mail.Part msg) -
getHeaderAsBytes
public static byte[] getHeaderAsBytes(javax.mail.Part part) -
toString
- Returns:
- same as
getWholeMessage(javax.mail.Part)}
-
random
Generates a random generated password consisting of letters and digits with a length variable between 5 and 8 characters long. Passwords are further optimized for displays that could potentially display the characters 1,l,I,0,O,Q in a way that a human could easily mix them up.- Returns:
-
random
-
sendTextEmailTest
-
sendTextEmailSecureTest
-
getAddressList
-
sendTextEmail
public static void sendTextEmail(String to, String from, String subject, String msg, ServerSetup setup) -
getSession
-
sendAttachmentEmail
public static void sendAttachmentEmail(String to, String from, String subject, String msg, byte[] attachment, String contentType, String filename, String description, ServerSetup setup) throws javax.mail.MessagingException, IOException - Throws:
javax.mail.MessagingExceptionIOException
-
convertUidsToIdRangeArray
-
uidsToRangeString
-
idRangeToString
-
idRangesToString
-