Package org.apache.commons.mail.util
Class MimeMessageUtils
- java.lang.Object
-
- org.apache.commons.mail.util.MimeMessageUtils
-
public final class MimeMessageUtils extends Object
Static helper methods.- Since:
- 1.3
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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 Detail
-
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
-
-