org.apache.commons.mail.util
Class MimeMessageUtils

java.lang.Object
  extended by org.apache.commons.mail.util.MimeMessageUtils

public final class MimeMessageUtils
extends Object

Static helper methods.

Since:
1.3
Version:
$Id: MimeMessageUtils.java 1420388 2012-12-11 20:28:35Z tn $

Method Summary
static MimeMessage createMimeMessage(Session session, byte[] source)
          Create a MimeMessage.
static MimeMessage createMimeMessage(Session session, File source)
          Create a MimeMessage.
static MimeMessage createMimeMessage(Session session, InputStream source)
          Create a MimeMessage.
static MimeMessage createMimeMessage(Session session, String source)
          Create a MimeMessage using the platform's default character encoding.
static void writeMimeMessage(MimeMessage mimeMessage, File resultFile)
          Convenience method to write a MimeMessage into a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createMimeMessage

public static MimeMessage createMimeMessage(Session session,
                                            byte[] source)
                                     throws MessagingException,
                                            IOException
Create a MimeMessage.

Parameters:
session - the mail session
source - the input data
Returns:
the MimeMessage
Throws:
MessagingException - creating the MimeMessage failed
IOException - creating the MimeMessage failed

createMimeMessage

public static MimeMessage createMimeMessage(Session session,
                                            File source)
                                     throws MessagingException,
                                            IOException
Create a MimeMessage.

Parameters:
session - the mail session
source - the input data
Returns:
the MimeMessage
Throws:
MessagingException - creating the MimeMessage failed
IOException - creating the MimeMessage failed

createMimeMessage

public static MimeMessage createMimeMessage(Session session,
                                            InputStream source)
                                     throws MessagingException
Create a MimeMessage.

Parameters:
session - the mail session
source - 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 session
source - the input data
Returns:
the MimeMessage
Throws:
MessagingException - creating the MimeMessage failed
IOException - 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 write
resultFile - the file containing the MimeMessgae
Throws:
MessagingException - accessing MimeMessage failed
IOException - writing the MimeMessage failed


Copyright © 2001-2013 The Apache Software Foundation. All Rights Reserved.