Package de.uplanet.lucy.server.mail
Class MailBuilder
java.lang.Object
de.uplanet.lucy.server.mail.MailBuilder
The MailBuilder class creates MIME messages with different content-types,
manages attachments, and inline pictures using HTML mail.
-
Constructor Summary
ConstructorDescriptionMailBuilder
(Path p_dirTmp, Path p_dirPickup, javax.mail.internet.InternetAddress p_addressFromFallback) -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
addRecipient
(javax.mail.Message.RecipientType p_rcpType, String p_strAddress) void
addRecipient
(javax.mail.Message.RecipientType p_rcpType, javax.mail.internet.InternetAddress p_address) void
addRecipientBcc
(String p_strAddress) void
addRecipientBcc
(javax.mail.internet.InternetAddress p_address) void
addRecipientCc
(String p_strAddress) void
addRecipientCc
(javax.mail.internet.InternetAddress p_address) void
addRecipientReplyTo
(String p_strAddress) void
addRecipientReplyTo
(javax.mail.internet.InternetAddress p_address) void
addRecipients
(javax.mail.Message.RecipientType p_rcpType, Collection<String> p_addresses) void
addRecipientsBcc
(Collection<String> p_addresses) void
addRecipientsCc
(Collection<String> p_addresses) void
addRecipientsReplyTo
(Collection<String> p_addresses) void
addRecipientsTo
(Collection<String> p_addresses) void
addRecipientTo
(String p_strAddress) void
addRecipientTo
(javax.mail.internet.InternetAddress p_address) void
attachFile
(de.uplanet.lucy.server.mail.AttachmentFile p_attachment) void
attachFile
(String p_strPath, String p_strFileName, String p_strContentType) void
attachRelatedFile
(de.uplanet.lucy.server.mail.AttachmentFile p_attachment) void
attachRelatedFile
(String p_strPath, String p_strFileName, String p_strContentType, String p_strContentId) void
Clears the content previously set withsetContent(String, String)
as well as all attachments.void
commit()
This method creates a MIME message and stores the message as file with the given name in the given directory.boolean
boolean
boolean
boolean
boolean
void
rollback()
send()
This method creates a MIME message and stores the message as file in the pickup folder.void
setAutoCommit
(boolean p_bAutoCommit) void
setContent
(String p_strContent, String p_strContentType) void
void
setFrom
(javax.mail.internet.InternetAddress p_addressFrom) void
setSubject
(String p_strSubject)
-
Constructor Details
-
MailBuilder
-
-
Method Details
-
setAutoCommit
public void setAutoCommit(boolean p_bAutoCommit) -
addHeader
-
hasRecipients
public boolean hasRecipients() -
hasRecipientsTo
public boolean hasRecipientsTo() -
hasRecipientsCc
public boolean hasRecipientsCc() -
hasRecipientsBcc
public boolean hasRecipientsBcc() -
hasRecipientsReplyTo
public boolean hasRecipientsReplyTo() -
addRecipient
public void addRecipient(javax.mail.Message.RecipientType p_rcpType, String p_strAddress) throws javax.mail.internet.AddressException - Throws:
javax.mail.internet.AddressException
- If the given address is not a valid Internet mail address.IllegalArgumentException
- Ifp_strAddress
isnull
or empty.
-
addRecipient
public void addRecipient(javax.mail.Message.RecipientType p_rcpType, javax.mail.internet.InternetAddress p_address) -
addRecipientTo
- Throws:
javax.mail.internet.AddressException
-
addRecipientTo
public void addRecipientTo(javax.mail.internet.InternetAddress p_address) -
addRecipientsTo
public void addRecipientsTo(Collection<String> p_addresses) throws javax.mail.internet.AddressException - Parameters:
p_addresses
- A collection of e-mail addresses.- Throws:
javax.mail.internet.AddressException
- If the given address is not a valid Internet mail address.
-
addRecipientCc
- Throws:
javax.mail.internet.AddressException
-
addRecipientCc
public void addRecipientCc(javax.mail.internet.InternetAddress p_address) -
addRecipientsCc
public void addRecipientsCc(Collection<String> p_addresses) throws javax.mail.internet.AddressException - Parameters:
p_addresses
- A collection of e-mail addresses.- Throws:
javax.mail.internet.AddressException
- If the given address is not a valid Internet mail address.
-
addRecipientBcc
- Throws:
javax.mail.internet.AddressException
-
addRecipientBcc
public void addRecipientBcc(javax.mail.internet.InternetAddress p_address) -
addRecipientsBcc
public void addRecipientsBcc(Collection<String> p_addresses) throws javax.mail.internet.AddressException - Parameters:
p_addresses
- A collection of e-mail addresses.- Throws:
javax.mail.internet.AddressException
- If the given address is not a valid Internet mail address.
-
addRecipientReplyTo
- Throws:
javax.mail.internet.AddressException
-
addRecipientReplyTo
public void addRecipientReplyTo(javax.mail.internet.InternetAddress p_address) -
addRecipientsReplyTo
public void addRecipientsReplyTo(Collection<String> p_addresses) throws javax.mail.internet.AddressException - Parameters:
p_addresses
- A collection of e-mail addresses.- Throws:
javax.mail.internet.AddressException
- If the given address is not a valid Internet mail address.
-
addRecipients
public void addRecipients(javax.mail.Message.RecipientType p_rcpType, Collection<String> p_addresses) throws javax.mail.internet.AddressException - Parameters:
p_rcpType
- The recipient type.p_addresses
- A collection of mail addresses.- Throws:
javax.mail.internet.AddressException
- If one of the given addresses is not a valid Internet mail address.
-
send
This method creates a MIME message and stores the message as file in the pickup folder.- Returns:
- The name of the mail file created.
- Throws:
javax.mail.MessagingException
IOException
InterruptedException
-
create
public Path create(String p_strFileName, Path p_dirTmp) throws javax.mail.MessagingException, IOException This method creates a MIME message and stores the message as file with the given name in the given directory.- Parameters:
p_strFileName
- The file name.p_dirTmp
- The directory whre the file sould be created.- Returns:
- The mail file created.
- Throws:
javax.mail.MessagingException
IOException
-
commit
- Throws:
InterruptedException
-
rollback
public void rollback() -
setContent
-
attachFile
public void attachFile(de.uplanet.lucy.server.mail.AttachmentFile p_attachment) -
attachFile
-
attachRelatedFile
-
attachRelatedFile
public void attachRelatedFile(de.uplanet.lucy.server.mail.AttachmentFile p_attachment) -
clearContentAndAttachments
public void clearContentAndAttachments()Clears the content previously set withsetContent(String, String)
as well as all attachments.For internal use only.
-
setFrom
- Throws:
javax.mail.internet.AddressException
-
setFrom
public void setFrom(javax.mail.internet.InternetAddress p_addressFrom) -
setSubject
-
createClone
-