Package de.uplanet.lucy.server.mail
Class GroovyMailBuilderWrapper
- java.lang.Object
-
- de.uplanet.lucy.server.mail.GroovyMailBuilderWrapper
-
public final class GroovyMailBuilderWrapper extends Object
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddBcc(Object p_address)Add aBccrecipient address.voidaddCc(Object p_address)Add aCcrecipient address.voidaddHeader(String p_strName, String p_strValue)Add a mail header.voidaddReplyTo(Object p_address)Add aReply-Toaddress.voidaddTo(Object p_address)Add aTorecipient address.voidattachFile(Object p_obj, String p_strContentType, String p_strName)Attach a file to this message.voidattachFile(Map<String,Object> p_namedArgs)Attach a file to this message.voidattachFileRelated(Object p_obj, String p_strContentType, String p_strName, String p_strContentId)Attach a file to this message.voidattachFileRelated(Map<String,Object> p_namedArgs)Attach a file to this message.Filedrop()Drop the mail as a file in the pickup folder.de.uplanet.lucy.server.mail.GroovyMailBuilderWrapper.BodyWrappergetBody()Get the mail body object.StringgetContentType()Get the content type of this mail.FilegetDirOutput()Set the (temporary) output directory for mail drop operations.FilegetDirPickup()Get the pickup directory for mail drop operations.StringgetSubject()Get the subject.booleanisUseTransaction()This flag indicates if mail sending (@link #drop() drop}) should be part of the current transaction if one exists.voidsend(Map<String,Object> p_namedArgs)voidsend(javax.mail.Session p_session)voidsetBcc(Object p_addresses)Set one or moreBccrecipient sddresses.voidsetBody(CharSequence p_chseq)Set the mail body as text.voidsetCc(Object p_addresses)Set one or moreCcrecipient sddresses.voidsetContentType(String p_strContentType)Set the content type of this mail.voidsetDirOutput(File p_dirOutput)Set the (temporary) output directory for mail drop operations.voidsetDirPickup(File p_dirPickup)Set the pickup directory for mail drop operations.voidsetFrom(Object p_address)Set theFromaddress.voidsetHeaders(Map<String,String> p_headers)Add the mail headers from the given map.voidsetReplyTo(Object p_addresses)Set one or moreReply-Tosddresses.voidsetSubject(String p_strSubject)Set the subject.voidsetTo(Object p_addresses)Set one or moreTorecipient sddresses.voidsetUseTransaction(boolean p_bUseTransaction)This flag indicates if mail sending (@link #drop() drop}) should be part of the current transaction if one exists.StringsrcInlineImage(Object p_obj)Add an inline image to this message.StringsrcInlineImage(Object p_obj, String p_strContentType)Add an inline image to this message.
-
-
-
Method Detail
-
setUseTransaction
public void setUseTransaction(boolean p_bUseTransaction)
This flag indicates if mail sending (@link #drop() drop}) should be part of the current transaction if one exists.Normally this is
trueby default.- Parameters:
p_bUseTransaction-trueif a transaction should be used, orfalseotherwise.
-
isUseTransaction
public boolean isUseTransaction()
This flag indicates if mail sending (@link #drop() drop}) should be part of the current transaction if one exists.Normally this is
trueby default.- Returns:
trueif a transaction should be used, orfalseotherwise.
-
getDirOutput
public File getDirOutput()
Set the (temporary) output directory for mail drop operations.This directory should reside on the same physical device as the
output directory.- Returns:
- The output directory.
-
setDirOutput
public void setDirOutput(File p_dirOutput)
Set the (temporary) output directory for mail drop operations.This directory should reside on the same physical device as the
pickup directory.- Parameters:
p_dirOutput- The output directory.
-
getDirPickup
public File getDirPickup()
Get the pickup directory for mail drop operations.This directory should reside on the same physical device as the
output directory.- Returns:
- The pickup directory.
-
setDirPickup
public void setDirPickup(File p_dirPickup)
Set the pickup directory for mail drop operations.This directory should reside on the same physical device as the
output directory.- Parameters:
p_dirPickup- The pickup directory.
-
setHeaders
public void setHeaders(Map<String,String> p_headers)
Add the mail headers from the given map.- Parameters:
p_headers- A map that contains the mail headers to be added.
-
addHeader
public void addHeader(String p_strName, String p_strValue)
Add a mail header.- Parameters:
p_strName- The header name.p_strValue- The header value.
-
setFrom
public void setFrom(Object p_address)
Set theFromaddress.- Parameters:
p_address- A character sequence, or aInternetAddress.
-
setTo
public void setTo(Object p_addresses)
Set one or moreTorecipient sddresses.- Parameters:
p_addresses- An address, or a collection of addresses.- Adresses can be character sequences (strings), or of the type
InternetAddress. - Address collections can be of the type
Collection, or one of its subtypes such as lists, or sets. Arrays are also supported. The contained elements must be of the same types as single addresses.
- Adresses can be character sequences (strings), or of the type
-
addTo
public void addTo(Object p_address)
Add aTorecipient address.- Parameters:
p_address- A character sequence, or aInternetAddress.
-
setCc
public void setCc(Object p_addresses)
Set one or moreCcrecipient sddresses.- Parameters:
p_addresses- An address, or a collection of addresses.- Adresses can be character sequences (strings), or of the type
InternetAddress. - Address collections can be of the type
Collection, or one of its subtypes such as lists, or sets. Arrays are also supported. The contained elements must be of the same types as single addresses.
- Adresses can be character sequences (strings), or of the type
-
addCc
public void addCc(Object p_address)
Add aCcrecipient address.- Parameters:
p_address- A character sequence, or aInternetAddress.
-
setBcc
public void setBcc(Object p_addresses)
Set one or moreBccrecipient sddresses.- Parameters:
p_addresses- An address, or a collection of addresses.- Adresses can be character sequences (strings), or of the type
InternetAddress. - Address collections can be of the type
Collection, or one of its subtypes such as lists, or sets. Arrays are also supported. The contained elements must be of the same types as single addresses.
- Adresses can be character sequences (strings), or of the type
-
addBcc
public void addBcc(Object p_address)
Add aBccrecipient address.- Parameters:
p_address- A character sequence, or aInternetAddress.
-
setReplyTo
public void setReplyTo(Object p_addresses)
Set one or moreReply-Tosddresses.- Parameters:
p_addresses- An address, or a collection of addresses.- Adresses can be character sequences (strings), or of the type
InternetAddress. - Address collections can be of the type
Collection, or one of its subtypes such as lists, or sets. Arrays are also supported. The contained elements must be of the same types as single addresses.
- Adresses can be character sequences (strings), or of the type
-
addReplyTo
public void addReplyTo(Object p_address)
Add aReply-Toaddress.- Parameters:
p_address- A character sequence, or aInternetAddress.
-
getSubject
public String getSubject()
Get the subject.- Returns:
- The subject.
-
setSubject
public void setSubject(String p_strSubject)
Set the subject.- Parameters:
p_strSubject- The subject.
-
getBody
public de.uplanet.lucy.server.mail.GroovyMailBuilderWrapper.BodyWrapper getBody()
Get the mail body object.- Returns:
- The mail body object.
-
setBody
public void setBody(CharSequence p_chseq)
Set the mail body as text.- Parameters:
p_chseq- The mail body content as text.
-
getContentType
public String getContentType()
Get the content type of this mail.Default is
text/plain.- Returns:
- The content type.
-
setContentType
public void setContentType(String p_strContentType)
Set the content type of this mail.Default is
text/plain.- Parameters:
p_strContentType- The content type.
-
attachFile
public void attachFile(Map<String,Object> p_namedArgs)
Attach a file to this message.Parameters are
file: the file to be attached, as a file object, or path (required)contentType: the content type of the file (required)name: the attachment's file name; if omitted, the name offilewill be used
- Parameters:
p_namedArgs- The named parameters.
-
attachFile
public void attachFile(Object p_obj, String p_strContentType, String p_strName)
Attach a file to this message.- Parameters:
p_obj- The file as a file object, or path.p_strContentType- The content type.p_strName- The attachment's file name.
-
attachFileRelated
public void attachFileRelated(Map<String,Object> p_namedArgs)
Attach a file to this message. This method is primarily used to attach inline images of HTML mails.Parameters are
file: the file to be attached, as a file object, or path (required)contentType: the content type of the file (required)name: the attachment's file name; if omitted, the name offilewill be usedcontentId: the attachment'sContent-ID
- Parameters:
p_namedArgs- The named parameters.
-
attachFileRelated
public void attachFileRelated(Object p_obj, String p_strContentType, String p_strName, String p_strContentId)
Attach a file to this message.- Parameters:
p_obj- The file as a file object, or path.p_strContentType- The content type.p_strName- The attachment's file name.p_strContentId- The attachment'sContent-ID.
-
srcInlineImage
public String srcInlineImage(Object p_obj)
Add an inline image to this message.The content type is derived from the extension of the given file. Supported extensions are
.png,.jpg,.jpeg,.jpe,.gif,.tif,.tiff, and.bmp.- Parameters:
p_obj- The inline image as a file object, or path.- Returns:
- The generated
Content-IDof the file.
-
srcInlineImage
public String srcInlineImage(Object p_obj, String p_strContentType)
Add an inline image to this message.- Parameters:
p_obj- The inline image as a file object, or path.p_strContentType- The content type of the image.- Returns:
- The generated
Content-IDof the file.
-
drop
public File drop() throws javax.mail.MessagingException, IOException
Drop the mail as a file in the pickup folder.- Returns:
- The dropped file.
- Throws:
javax.mail.MessagingExceptionIOException
-
send
public void send(Map<String,Object> p_namedArgs) throws javax.mail.MessagingException, IOException
- Throws:
javax.mail.MessagingExceptionIOException
-
send
public void send(javax.mail.Session p_session) throws javax.mail.MessagingException, IOException- Throws:
javax.mail.MessagingExceptionIOException
-
-