Package org.apache.commons.mail.util
Class MimeMessageUtils
java.lang.Object
org.apache.commons.mail.util.MimeMessageUtils
Static helper methods.
- Since:
- 1.3
-
Method Summary
Modifier and TypeMethodDescriptionstatic MimeMessagecreateMimeMessage(Session session, byte[] source) Create a MimeMessage.static MimeMessagecreateMimeMessage(Session session, File source) Create a MimeMessage.static MimeMessagecreateMimeMessage(Session session, InputStream source) Create a MimeMessage.static MimeMessagecreateMimeMessage(Session session, String source) Create a MimeMessage using the platform's default character encoding.static voidwriteMimeMessage(MimeMessage mimeMessage, File resultFile) Convenience method to write a MimeMessage into a file.
-
Method Details
-
createMimeMessage
public static MimeMessage createMimeMessage(Session session, byte[] source) throws MessagingException, IOException Create a MimeMessage.- Parameters:
session- the mail sessionsource- the input data- Returns:
- the MimeMessage
- Throws:
MessagingException- creating the MimeMessage failedIOException- creating the MimeMessage failed
-
createMimeMessage
public static MimeMessage createMimeMessage(Session session, File source) throws MessagingException, IOException Create a MimeMessage.- Parameters:
session- the mail sessionsource- the input data- Returns:
- the MimeMessage
- Throws:
MessagingException- creating the MimeMessage failedIOException- creating the MimeMessage failed
-
createMimeMessage
public static MimeMessage createMimeMessage(Session session, 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, String source) throws MessagingException, 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 failedIOException- creating the MimeMessage failed
-
writeMimeMessage
public static void writeMimeMessage(MimeMessage mimeMessage, File resultFile) throws MessagingException, 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 failedIOException- writing the MimeMessage failed
-