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
ConstructorsConstructorDescriptionMailBuilder(Path p_dirTmp, Path p_dirPickup, javax.mail.internet.InternetAddress p_addressFromFallback) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidaddRecipient(javax.mail.Message.RecipientType p_rcpType, String p_strAddress) voidaddRecipient(javax.mail.Message.RecipientType p_rcpType, javax.mail.internet.InternetAddress p_address) voidaddRecipientBcc(String p_strAddress) voidaddRecipientBcc(javax.mail.internet.InternetAddress p_address) voidaddRecipientCc(String p_strAddress) voidaddRecipientCc(javax.mail.internet.InternetAddress p_address) voidaddRecipientReplyTo(String p_strAddress) voidaddRecipientReplyTo(javax.mail.internet.InternetAddress p_address) voidaddRecipients(javax.mail.Message.RecipientType p_rcpType, Collection<String> p_addresses) voidaddRecipientsBcc(Collection<String> p_addresses) voidaddRecipientsCc(Collection<String> p_addresses) voidaddRecipientsReplyTo(Collection<String> p_addresses) voidaddRecipientsTo(Collection<String> p_addresses) voidaddRecipientTo(String p_strAddress) voidaddRecipientTo(javax.mail.internet.InternetAddress p_address) voidattachFile(de.uplanet.lucy.server.mail.AttachmentFile p_attachment) voidattachFile(String p_strPath, String p_strFileName, String p_strContentType) voidattachRelatedFile(de.uplanet.lucy.server.mail.AttachmentFile p_attachment) voidattachRelatedFile(String p_strPath, String p_strFileName, String p_strContentType, String p_strContentId) voidClears the content previously set withsetContent(String, String)as well as all attachments.voidcommit()This method creates a MIME message and stores the message as file with the given name in the given directory.booleanbooleanbooleanbooleanbooleanvoidrollback()send()This method creates a MIME message and stores the message as file in the pickup folder.voidsetAutoCommit(boolean p_bAutoCommit) voidsetContent(String p_strContent, String p_strContentType) voidvoidsetFrom(javax.mail.internet.InternetAddress p_addressFrom) voidsetSubject(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_strAddressisnullor 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.MessagingExceptionIOExceptionInterruptedException
-
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.MessagingExceptionIOException
-
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
-