org.silverpeas.mail
Class MailContent

java.lang.Object
  extended by org.silverpeas.mail.MailContent

public class MailContent
extends Object

Author:
Yohann Chastagnier

Field Summary
static MailContent EMPTY
           
 
Method Summary
 void applyOn(javax.mail.internet.MimeMessage message)
          Applies the content information on a MimeMessage.
 MailContent notHtml()
          Forces the information that the content is not an HTML one.
static MailContent of(javax.mail.Multipart multipart)
          Gets a new instance of MimeMessage by specifying a content as a Multipart.
static MailContent of(String content)
          Gets a new instance of MimeMessage by specifying a content as a string.
 String toString()
           
 MailContent withContentType(String contentType)
          Sets the content type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY

public static final MailContent EMPTY
Method Detail

of

public static MailContent of(String content)
Gets a new instance of MimeMessage by specifying a content as a string.

Parameters:
content - the string content
Returns:
a new instance of MimeMessage.

of

public static MailContent of(javax.mail.Multipart multipart)
Gets a new instance of MimeMessage by specifying a content as a Multipart.

Parameters:
multipart - the Multipart content
Returns:
a new instance of MimeMessage.

notHtml

public MailContent notHtml()
Forces the information that the content is not an HTML one. By default, the content is considered as an HTML one.

Returns:
the instance of MailContent.

withContentType

public MailContent withContentType(String contentType)
Sets the content type.

Parameters:
contentType - the content type to set.
Returns:
the instance of MailContent.

applyOn

public void applyOn(javax.mail.internet.MimeMessage message)
             throws javax.mail.MessagingException
Applies the content information on a MimeMessage. If the content is a string and contains <html> TAG, then the content is considered as an HTML one, even if isHtml() returns false.

Parameters:
message - the MimeMessage.
Throws:
javax.mail.MessagingException

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2016 Silverpeas. All Rights Reserved.