Holger's Java API

## com.antelmann.net.mail
Class EmailConverter

    java.lang.Object
      com.antelmann.net.mail.EmailConverter

All Implemented Interfaces:
  Converter<Email,javax.mail.Message>

    public class EmailConverter

extends Object
implements Converter<Email,javax.mail.Message>

allows to transform Email instances into Message instances and vice versa

Since:
  25.02.2009, 18:41:04
Author:
  Holger Antelmann
See Also:
  `Email`, `Message`

Nested Class Summary

Nested classes/interfaces inherited from interface com.antelmann.util.Converter
`Converter.Adapter<T1,T2>`

Constructor Summary
`EmailConverter()`
`EmailConverter(POP3Account account)`
`EmailConverter(javax.mail.Session session)`

Method Summary
`javax.mail.Message` `convert(Email email)`
`Email` `convertBack(javax.mail.Message message)`
`javax.mail.internet.MimeMessage` `createMessage(Email email)` if no 'from' address is configured, the embedded 'from' address from the account is used - if given
`static String` `exportAsString(javax.mail.Message message)` includes all internet header
`static Email` `extractEmail(javax.mail.Message msg)`
`POP3Account` `getAccount()`
`javax.mail.Session` `getSession()`
`javax.mail.internet.MimeMessage` `loadEML(InputStream in)`
`static void` `saveEML(javax.mail.Message msg, OutputStream out)`
`void` `setAccount(POP3Account account)`
`void` `setSession(javax.mail.Session session)`
`static void` `storeAsEML(javax.mail.Message msg, File file)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### EmailConverter

    public EmailConverter()

### EmailConverter

    public EmailConverter(javax.mail.Session session)

### EmailConverter

    public EmailConverter(POP3Account account)

Method Detail

### getSession

    public javax.mail.Session getSession()

### setSession

    public void setSession(javax.mail.Session session)

### getAccount

    public POP3Account getAccount()

### setAccount

    public void setAccount(POP3Account account)

### convert

    public javax.mail.Message convert(Email email)

  Specified by:
    `convert` in interface `Converter<Email,javax.mail.Message>`

### convertBack

    public Email convertBack(javax.mail.Message message)

  Specified by:
    `convertBack` in interface `Converter<Email,javax.mail.Message>`

### loadEML

    public javax.mail.internet.MimeMessage loadEML(InputStream in)
                                            throws javax.mail.MessagingException

  Throws:
    `javax.mail.MessagingException`

### storeAsEML

    public static void storeAsEML(javax.mail.Message msg,
                                  File file)
                           throws IOException,
                                  javax.mail.MessagingException

  Throws:
    `IOException`
    `javax.mail.MessagingException`

### saveEML

    public static void saveEML(javax.mail.Message msg,
                               OutputStream out)
                        throws IOException,
                               javax.mail.MessagingException

  Throws:
    `IOException`
    `javax.mail.MessagingException`

### exportAsString

    public static String exportAsString(javax.mail.Message message)
                                 throws IOException,
                                        javax.mail.MessagingException

  includes all internet header

  Throws:
    `IOException`
    `javax.mail.MessagingException`

### createMessage

    public javax.mail.internet.MimeMessage createMessage(Email email)
                                                  throws javax.mail.MessagingException

  if no 'from' address is configured, the embedded 'from' address from the account is used - if given

  Throws:
    `javax.mail.MessagingException`

### extractEmail

    public static Email extractEmail(javax.mail.Message msg)
                              throws javax.mail.MessagingException,
                                     IOException

  Throws:
    `javax.mail.MessagingException`
    `IOException`

(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads