Package org.apache.commons.mail.util
Class MimeMessageUtils
- java.lang.Object
-
- org.apache.commons.mail.util.MimeMessageUtils
-
public final class MimeMessageUtils extends java.lang.Object
Static helper methods.- Since:
- 1.3
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static MimeMessage
createMimeMessage(Session session, byte[] source)
Create a MimeMessage.static MimeMessage
createMimeMessage(Session session, java.io.File source)
Create a MimeMessage.static MimeMessage
createMimeMessage(Session session, java.io.InputStream source)
Create a MimeMessage.static MimeMessage
createMimeMessage(Session session, java.lang.String source)
Create a MimeMessage using the platform's default character encoding.static void
writeMimeMessage(MimeMessage mimeMessage, java.io.File resultFile)
Convenience method to write a MimeMessage into a file.
-
-
-
Method Detail
-
createMimeMessage
public static MimeMessage createMimeMessage(Session session, byte[] source) throws MessagingException, java.io.IOException
Create a MimeMessage.- Parameters:
session
- the mail sessionsource
- the input data- Returns:
- the MimeMessage
- Throws:
MessagingException
- creating the MimeMessage failedjava.io.IOException
- creating the MimeMessage failed
-
createMimeMessage
public static MimeMessage createMimeMessage(Session session, java.io.File source) throws MessagingException, java.io.IOException
Create a MimeMessage.- Parameters:
session
- the mail sessionsource
- the input data- Returns:
- the MimeMessage
- Throws:
MessagingException
- creating the MimeMessage failedjava.io.IOException
- creating the MimeMessage failed
-
createMimeMessage
public static MimeMessage createMimeMessage(Session session, java.io.InputStream source) throws MessagingException
Create a MimeMessage.- Parameters:
session
- the mail sessionsource
- the input data- Returns:
- the MimeMessage
- Throws:
MessagingException
- creating the MimeMessage failed
-
createMimeMessage
public static MimeMessage createMimeMessage(Session session, java.lang.String source) throws MessagingException, java.io.IOException
Create a MimeMessage using the platform's default character encoding.- Parameters:
session
- the mail sessionsource
- the input data- Returns:
- the MimeMessage
- Throws:
MessagingException
- creating the MimeMessage failedjava.io.IOException
- creating the MimeMessage failed
-
writeMimeMessage
public static void writeMimeMessage(MimeMessage mimeMessage, java.io.File resultFile) throws MessagingException, java.io.IOException
Convenience method to write a MimeMessage into a file.- Parameters:
mimeMessage
- the MimeMessage to writeresultFile
- the file containing the MimeMessgae- Throws:
MessagingException
- accessing MimeMessage failedjava.io.IOException
- writing the MimeMessage failed
-
-