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 void
addBcc(Object p_address)
Add aBcc
recipient address.void
addCc(Object p_address)
Add aCc
recipient address.void
addHeader(String p_strName, String p_strValue)
Add a mail header.void
addReplyTo(Object p_address)
Add aReply-To
address.void
addTo(Object p_address)
Add aTo
recipient address.void
attachFile(Object p_obj, String p_strContentType, String p_strName)
Attach a file to this message.void
attachFile(Map<String,Object> p_namedArgs)
Attach a file to this message.void
attachFileRelated(Object p_obj, String p_strContentType, String p_strName, String p_strContentId)
Attach a file to this message.void
attachFileRelated(Map<String,Object> p_namedArgs)
Attach a file to this message.File
drop()
Drop the mail as a file in the pickup folder.de.uplanet.lucy.server.mail.GroovyMailBuilderWrapper.BodyWrapper
getBody()
Get the mail body object.String
getContentType()
Get the content type of this mail.File
getDirOutput()
Set the (temporary) output directory for mail drop operations.File
getDirPickup()
Get the pickup directory for mail drop operations.String
getSubject()
Get the subject.boolean
isUseTransaction()
This flag indicates if mail sending (@link #drop() drop}
) should be part of the current transaction if one exists.void
send(Map<String,Object> p_namedArgs)
void
send(javax.mail.Session p_session)
void
setBcc(Object p_addresses)
Set one or moreBcc
recipient sddresses.void
setBody(CharSequence p_chseq)
Set the mail body as text.void
setCc(Object p_addresses)
Set one or moreCc
recipient sddresses.void
setContentType(String p_strContentType)
Set the content type of this mail.void
setDirOutput(File p_dirOutput)
Set the (temporary) output directory for mail drop operations.void
setDirPickup(File p_dirPickup)
Set the pickup directory for mail drop operations.void
setFrom(Object p_address)
Set theFrom
address.void
setHeaders(Map<String,String> p_headers)
Add the mail headers from the given map.void
setReplyTo(Object p_addresses)
Set one or moreReply-To
sddresses.void
setSubject(String p_strSubject)
Set the subject.void
setTo(Object p_addresses)
Set one or moreTo
recipient sddresses.void
setUseTransaction(boolean p_bUseTransaction)
This flag indicates if mail sending (@link #drop() drop}
) should be part of the current transaction if one exists.String
srcInlineImage(Object p_obj)
Add an inline image to this message.String
srcInlineImage(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
true
by default.- Parameters:
p_bUseTransaction
-true
if a transaction should be used, orfalse
otherwise.
-
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
true
by default.- Returns:
true
if a transaction should be used, orfalse
otherwise.
-
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 theFrom
address.- Parameters:
p_address
- A character sequence, or aInternetAddress
.
-
setTo
public void setTo(Object p_addresses)
Set one or moreTo
recipient 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 aTo
recipient address.- Parameters:
p_address
- A character sequence, or aInternetAddress
.
-
setCc
public void setCc(Object p_addresses)
Set one or moreCc
recipient 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 aCc
recipient address.- Parameters:
p_address
- A character sequence, or aInternetAddress
.
-
setBcc
public void setBcc(Object p_addresses)
Set one or moreBcc
recipient 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 aBcc
recipient address.- Parameters:
p_address
- A character sequence, or aInternetAddress
.
-
setReplyTo
public void setReplyTo(Object p_addresses)
Set one or moreReply-To
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
-
addReplyTo
public void addReplyTo(Object p_address)
Add aReply-To
address.- 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 offile
will 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 offile
will 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-ID
of 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-ID
of 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.MessagingException
IOException
-
send
public void send(Map<String,Object> p_namedArgs) throws javax.mail.MessagingException, IOException
- Throws:
javax.mail.MessagingException
IOException
-
send
public void send(javax.mail.Session p_session) throws javax.mail.MessagingException, IOException
- Throws:
javax.mail.MessagingException
IOException
-
-