play.libs
Class Mail

java.lang.Object
  extended by play.libs.Mail

public class Mail
extends java.lang.Object

Mail utils


Nested Class Summary
static class Mail.Mock
           
static class Mail.SMTPAuthenticator
           
 
Field Summary
static boolean asynchronousSend
           
static javax.mail.Session session
           
 
Constructor Summary
Mail()
           
 
Method Summary
static javax.mail.internet.MimeMessage buildMessage(java.lang.Object from, java.lang.Object replyTo, java.lang.Object[] recipients, java.lang.String subject, java.lang.String body, java.lang.String alternate, java.lang.String contentType, java.lang.Object... attachments)
          Construct a MimeMessage
static java.util.concurrent.Future<java.lang.Boolean> send(java.lang.Object from, java.lang.Object replyTo, java.lang.Object[] recipients, java.lang.String subject, java.lang.String body, java.lang.String alternate, java.lang.String contentType, java.lang.Object... attachments)
          Send an email
static java.util.concurrent.Future<java.lang.Boolean> send(java.lang.String from, java.lang.String[] recipients, java.lang.String subject, java.lang.String body)
          Send an email in text/plain format
static java.util.concurrent.Future<java.lang.Boolean> send(java.lang.String from, java.lang.String[] recipients, java.lang.String subject, java.lang.String body, java.lang.Object... attachments)
          Send an email in text/plain
static java.util.concurrent.Future<java.lang.Boolean> send(java.lang.String from, java.lang.String recipient, java.lang.String subject, java.lang.String body)
          Send an email in plain text
static java.util.concurrent.Future<java.lang.Boolean> send(java.lang.String from, java.lang.String recipient, java.lang.String subject, java.lang.String body, java.lang.Object... attachments)
          Send an email in text/plain
static java.util.concurrent.Future<java.lang.Boolean> send(java.lang.String from, java.lang.String recipient, java.lang.String subject, java.lang.String body, java.lang.String alternate)
          Send an email in text/html with a text/plain alternative
static java.util.concurrent.Future<java.lang.Boolean> send(java.lang.String from, java.lang.String recipient, java.lang.String subject, java.lang.String body, java.lang.String alternate, java.lang.Object... obj)
          Send an email in text/html with a text/plain alternative and attachments
static java.util.concurrent.Future<java.lang.Boolean> sendMessage(javax.mail.Message msg)
          Send a JavaMail message
 
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
Constructor Detail

Mail

public Mail()
Method Detail

send

public static java.util.concurrent.Future<java.lang.Boolean> send(java.lang.String from,
                                                                  java.lang.String recipient,
                                                                  java.lang.String subject,
                                                                  java.lang.String body)
Send an email in plain text

Parameters:
from - From address
recipient - To address
subject - Subject
body - Body

send

public static java.util.concurrent.Future<java.lang.Boolean> send(java.lang.String from,
                                                                  java.lang.String recipient,
                                                                  java.lang.String subject,
                                                                  java.lang.String body,
                                                                  java.lang.String alternate)
Send an email in text/html with a text/plain alternative

Parameters:
from - From address
recipient - To address
subject - Subject
body - text/html body content
alternate - text/plain alternative content (optional)

send

public static java.util.concurrent.Future<java.lang.Boolean> send(java.lang.String from,
                                                                  java.lang.String recipient,
                                                                  java.lang.String subject,
                                                                  java.lang.String body,
                                                                  java.lang.String alternate,
                                                                  java.lang.Object... obj)
Send an email in text/html with a text/plain alternative and attachments

Parameters:
from - From address
recipient - To address
subject - Subject
body - text/html body content
alternate - text/plain alternative content (optional)
obj - the attachments to the email

send

public static java.util.concurrent.Future<java.lang.Boolean> send(java.lang.String from,
                                                                  java.lang.String[] recipients,
                                                                  java.lang.String subject,
                                                                  java.lang.String body)
Send an email in text/plain format

Parameters:
from - From address
recipients - To addresses
subject - Subject
body - The text/plain body of the email

send

public static java.util.concurrent.Future<java.lang.Boolean> send(java.lang.String from,
                                                                  java.lang.String recipient,
                                                                  java.lang.String subject,
                                                                  java.lang.String body,
                                                                  java.lang.Object... attachments)
Send an email in text/plain

Parameters:
from - From address
recipient - To address
subject - Subject
body - plain/text body of the email
attachments - File attachments

send

public static java.util.concurrent.Future<java.lang.Boolean> send(java.lang.String from,
                                                                  java.lang.String[] recipients,
                                                                  java.lang.String subject,
                                                                  java.lang.String body,
                                                                  java.lang.Object... attachments)
Send an email in text/plain

Parameters:
from - From address
recipients - To addresses
subject - Subject
body - Body
attachments - File attachments

send

public static java.util.concurrent.Future<java.lang.Boolean> send(java.lang.Object from,
                                                                  java.lang.Object replyTo,
                                                                  java.lang.Object[] recipients,
                                                                  java.lang.String subject,
                                                                  java.lang.String body,
                                                                  java.lang.String alternate,
                                                                  java.lang.String contentType,
                                                                  java.lang.Object... attachments)
Send an email

Parameters:
from - From address
replyTo - ReplyTo address
recipients - To addresses
subject - Subject
body - body of the email
alternate - text/plain body (optional). This parameter is ignored if contentType is set to text/plain or is null.
contentType - The content type of the body (text/plain or text/html)
attachments - File attachments

buildMessage

public static javax.mail.internet.MimeMessage buildMessage(java.lang.Object from,
                                                           java.lang.Object replyTo,
                                                           java.lang.Object[] recipients,
                                                           java.lang.String subject,
                                                           java.lang.String body,
                                                           java.lang.String alternate,
                                                           java.lang.String contentType,
                                                           java.lang.Object... attachments)
                                                    throws javax.mail.MessagingException
Construct a MimeMessage

Parameters:
from - From address
recipients - To addresses
subject - Subject
body - body of the email
alternate - text/plain body (optional). This parameter is ignored if contentType is set to text/plain or is null.
contentType - The content type of the body (text/plain or text/html) (optional)
attachments - File attachments
Throws:
javax.mail.MessagingException

sendMessage

public static java.util.concurrent.Future<java.lang.Boolean> sendMessage(javax.mail.Message msg)
Send a JavaMail message

Parameters:
msg - A JavaMail message


Guillaume Bort & zenexity - Distributed under Apache 2 licence, without any warrantly