|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.emarsys.ecommon.mail.JMailFactory
public class JMailFactory
A factory for JavaMail(tm) Message
s.
Field Summary | |
---|---|
protected javax.mail.Multipart |
mainPart
|
protected javax.mail.internet.MimeMessage |
message
|
protected javax.mail.Session |
session
|
protected javax.mail.internet.MimeBodyPart |
textPart
|
Constructor Summary | |
---|---|
JMailFactory()
Creates a new JMailFactory with a default
Session driven by the System
Properties . |
|
JMailFactory(java.util.Properties settings)
Creates a new JMailFactory with a Session
driven by the passed Properties . |
|
JMailFactory(javax.mail.Session session)
Creates a new JMailFactory instance
associated with the passed JavaMail Session . |
Method Summary | |
---|---|
JMailFactory |
addAttachment(java.io.ByteArrayOutputStream stream,
java.lang.String fileName)
|
JMailFactory |
addAttachment(java.io.File file)
|
JMailFactory |
addBCC(java.lang.String bcc)
Adds the passed BCC recipient to this Message . |
JMailFactory |
addBCCs(java.lang.String bccs)
Adds the passed BCC recipients to this Message . |
JMailFactory |
addCC(java.lang.String cc)
Adds the passed CC recipient to this Message . |
JMailFactory |
addCCs(java.lang.String ccs)
Adds the passed CC recipients to this Message . |
JMailFactory |
addTO(java.lang.String to)
Add the passed TO recipient to this Message . |
JMailFactory |
addTOs(java.lang.String tos)
Adds the passed TO recipients to this Message . |
javax.mail.Address[] |
getFrom()
|
static JMailFactory |
getInstance(java.util.Properties props)
A factory method which might create specific JMailFactory instances according to the
Properties passed. |
protected java.lang.String |
getMailEncoding()
|
javax.mail.Message |
getMessage()
|
byte[] |
getMessageBytes()
|
javax.mail.Address[] |
getRecipients(javax.mail.Message.RecipientType type)
|
javax.mail.Address[] |
getReplyTo()
|
boolean |
hasFrom()
|
boolean |
hasText()
|
protected void |
init()
|
protected boolean |
isMailEncodingSet()
|
JMailFactory |
setFrom(javax.mail.Address from)
|
JMailFactory |
setFrom(java.lang.String from)
|
JMailFactory |
setReplyTos(javax.mail.Address[] replyTos)
Adds the passed REPLY-TO Address es to this
Message . |
JMailFactory |
setReplyTos(java.lang.String replyTos)
Adds the passed REPLY-TO addresses to this Message . |
JMailFactory |
setSubject(java.lang.String subject)
|
JMailFactory |
setText(java.lang.String msg)
|
protected static void |
splitAddressesAndPerform(java.lang.String addresses,
Closure<java.lang.String> closure)
Splits the passed addresses on commas and performs the passed Closure on the splitted String s. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected javax.mail.Session session
protected javax.mail.internet.MimeMessage message
protected javax.mail.Multipart mainPart
protected javax.mail.internet.MimeBodyPart textPart
Constructor Detail |
---|
public JMailFactory(java.util.Properties settings) throws javax.mail.MessagingException, java.lang.IllegalArgumentException
JMailFactory
with a Session
driven by the passed Properties
.
props
-
javax.mail.MessagingException
java.lang.IllegalArgumentException
public JMailFactory() throws javax.mail.MessagingException
JMailFactory
with a default
Session
driven by the System
Properties
.
javax.mail.MessagingException
#JMailFactory(Properties)}
public JMailFactory(javax.mail.Session session) throws javax.mail.MessagingException, java.lang.IllegalArgumentException
JMailFactory
instance
associated with the passed JavaMail Session
.
session
-
javax.mail.MessagingException
java.lang.IllegalArgumentException
Method Detail |
---|
public static JMailFactory getInstance(java.util.Properties props) throws javax.mail.MessagingException
JMailFactory
instances according to the
Properties
passed.
props
-
JMailFactory
instance that will be
initialized with the passed Properties
.
javax.mail.MessagingException
protected static void splitAddressesAndPerform(java.lang.String addresses, Closure<java.lang.String> closure)
Closure
on the splitted String
s.
addresses
- - a comma ',' seperated list of email addressesclosure
- - the function to execute on each of the splitted
addressesprotected void init() throws javax.mail.MessagingException
javax.mail.MessagingException
public javax.mail.Message getMessage() throws java.lang.IllegalArgumentException, javax.mail.internet.AddressException, javax.mail.MessagingException
javax.mail.MessagingException
javax.mail.internet.AddressException
java.lang.IllegalArgumentException
public byte[] getMessageBytes() throws javax.mail.internet.AddressException, java.lang.IllegalArgumentException, java.io.IOException, javax.mail.MessagingException
javax.mail.MessagingException
java.io.IOException
java.lang.IllegalArgumentException
javax.mail.internet.AddressException
public JMailFactory addTO(java.lang.String to) throws javax.mail.internet.AddressException, javax.mail.MessagingException
Message
.
to
- - the email address of the TO recipient
JMailFactory
.
javax.mail.internet.AddressException
javax.mail.MessagingException
public JMailFactory addTOs(java.lang.String tos) throws javax.mail.internet.AddressException, javax.mail.MessagingException
Message
.
to
- String of e-mail-adresses separated by ','
javax.mail.internet.AddressException
javax.mail.MessagingException
public JMailFactory addCC(java.lang.String cc) throws javax.mail.internet.AddressException, javax.mail.MessagingException
Message
.
cc
-
javax.mail.internet.AddressException
javax.mail.MessagingException
public JMailFactory addCCs(java.lang.String ccs) throws javax.mail.internet.AddressException, javax.mail.MessagingException
Message
.
to
- String of e-mail-adresses separated by ','
javax.mail.internet.AddressException
javax.mail.MessagingException
public JMailFactory addBCC(java.lang.String bcc) throws javax.mail.internet.AddressException, javax.mail.MessagingException
Message
.
bcc
-
javax.mail.internet.AddressException
javax.mail.MessagingException
public JMailFactory addBCCs(java.lang.String bccs) throws javax.mail.internet.AddressException, javax.mail.MessagingException
Message
.
to
- String of e-mail-adresses separated by ','
javax.mail.internet.AddressException
javax.mail.MessagingException
public JMailFactory setReplyTos(java.lang.String replyTos) throws javax.mail.internet.AddressException, javax.mail.MessagingException
Message
.
to
- String of e-mail-adresses separated by ','
javax.mail.internet.AddressException
javax.mail.MessagingException
public JMailFactory setReplyTos(javax.mail.Address[] replyTos) throws javax.mail.MessagingException
Address
es to this
Message
.
replyTos
-
javax.mail.MessagingException
public JMailFactory setFrom(java.lang.String from) throws javax.mail.internet.AddressException, javax.mail.MessagingException
from
-
javax.mail.internet.AddressException
javax.mail.MessagingException
public JMailFactory setFrom(javax.mail.Address from) throws javax.mail.MessagingException
from
-
javax.mail.MessagingException
public boolean hasFrom() throws javax.mail.internet.AddressException, java.lang.IllegalArgumentException, javax.mail.MessagingException
javax.mail.MessagingException
java.lang.IllegalArgumentException
javax.mail.internet.AddressException
public JMailFactory setSubject(java.lang.String subject) throws javax.mail.MessagingException
subject
-
javax.mail.MessagingException
public JMailFactory setText(java.lang.String msg) throws javax.mail.MessagingException
msg
-
javax.mail.MessagingException
public boolean hasText()
public JMailFactory addAttachment(java.io.File file) throws javax.mail.MessagingException, java.io.FileNotFoundException
file
-
javax.mail.MessagingException
java.io.FileNotFoundException
public JMailFactory addAttachment(java.io.ByteArrayOutputStream stream, java.lang.String fileName) throws javax.mail.MessagingException
stream
- fileName
-
javax.mail.MessagingException
public javax.mail.Address[] getFrom() throws javax.mail.MessagingException
javax.mail.MessagingException
public javax.mail.Address[] getRecipients(javax.mail.Message.RecipientType type) throws javax.mail.MessagingException
type
-
javax.mail.MessagingException
public javax.mail.Address[] getReplyTo() throws javax.mail.MessagingException
javax.mail.MessagingException
protected java.lang.String getMailEncoding()
protected boolean isMailEncodingSet()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |