play.libs

## Class Mail

- java.lang.Object
- - play.libs.Mail

    public class Mail
    extends java.lang.Object

Mail utils

### Nested Class Summary

Nested Classes
`static class` `Mail.SMTPAuthenticator`

### Field Summary

Fields
`static boolean` `asynchronousSend`
`protected static AbstractMailSystemFactory` `mailSystemFactory`
`static LegacyMockMailSystem` `Mock` Just kept for compatibility reasons, use test double substitution mechanism instead.
`static javax.mail.Session` `session`

### Constructor Summary

Constructors
Constructor and Description
`Mail()`

### Method Summary

All Methods Static Methods Concrete Methods
`static org.apache.commons.mail.Email` `buildMessage(org.apache.commons.mail.Email email)`
`protected static MailSystem` `currentMailSystem()`
`static javax.mail.Session` `getSession()`
`static void` `resetMailSystem()`
`static java.util.concurrent.Future<java.lang.Boolean>` `send(org.apache.commons.mail.Email email)` Send an email
`static java.util.concurrent.Future<java.lang.Boolean>` `sendMessage(org.apache.commons.mail.Email msg)` Send a JavaMail message
`static void` `useMailSystem(MailSystem mailSystem)` Through this method you can substitute the current MailSystem.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### session

    public static javax.mail.Session session

#### asynchronousSend

    public static boolean asynchronousSend

#### mailSystemFactory

    protected static AbstractMailSystemFactory mailSystemFactory

#### Mock

    public static LegacyMockMailSystem Mock

Just kept for compatibility reasons, use test double substitution mechanism instead.

See Also:
  `useMailSystem(MailSystem)`

### Constructor Detail

#### Mail

    public Mail()

### Method Detail

#### send

    public static java.util.concurrent.Future<java.lang.Boolean> send(org.apache.commons.mail.Email email)

Send an email

Parameters:
  `email` - An Email message
Returns:
  true if email successfully send

#### currentMailSystem

    protected static MailSystem currentMailSystem()

#### useMailSystem

    public static void useMailSystem(MailSystem mailSystem)

Through this method you can substitute the current MailSystem. This is especially helpful for testing purposes like using mock libraries.

Parameters:
  `mailSystem` - The mailSystem to use
See Also:
  `MailSystem`

#### resetMailSystem

    public static void resetMailSystem()

#### buildMessage

    public static org.apache.commons.mail.Email buildMessage(org.apache.commons.mail.Email email)
                                                      throws org.apache.commons.mail.EmailException

Throws:
  `org.apache.commons.mail.EmailException`

#### getSession

    public static javax.mail.Session getSession()

#### sendMessage

    public static java.util.concurrent.Future<java.lang.Boolean> sendMessage(org.apache.commons.mail.Email msg)

Send a JavaMail message

Parameters:
  `msg` - An Email message
Returns:
  true if email successfully send