Package lumis.portal.sendmail
Interface IMailAttachment
-
@StableMinor(version="16.1", sinceVersion="4.0") public interface IMailAttachment
Stores information about a mail attachment.- Since:
- 4.0.4
- Version:
- $Revision: 26156 $ $Date: 2024-01-13 10:26:46 -0300 (Sat, 13 Jan 2024) $
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
IMailAttachment.ContentDispositionType
Content disposition types for aIMailAttachment
.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default java.lang.String
embed()
Sets the content disposition type for this attachment toIMailAttachment.ContentDispositionType.INLINE
and returns the URI for referencing this attachment in its e-mail.java.sql.Blob
getContent()
Returns the content of this attachment.IMailAttachment.ContentDispositionType
getContentDispositionType()
Returns the content disposition type set for this attachment.java.lang.String
getContentId()
Returns the content identifier used to construct the URI used refer to this attachment when it is inline.java.io.InputStream
getContentInputStream()
Gets the content input stream for this mail attachment.java.lang.String
getContentType()
Returns the mime content type of this attachment.java.lang.String
getDescription()
Returns the description of this attachment.java.lang.String
getId()
Returns a unique identifier for this attachment.java.lang.String
getName()
Returns the name of this attachment.void
setContent(java.io.InputStream inputStream, int length)
Sets the content for this mail attachment.void
setContentDispositionType(IMailAttachment.ContentDispositionType disposition)
Sets the content disposition type for this attachment.void
setContentType(java.lang.String contentType)
Sets the mime content type of this attachment.void
setDescription(java.lang.String description)
Sets the description of this attachment.void
setName(java.lang.String name)
Sets the name of this attachment.
-
-
-
Method Detail
-
getContentType
java.lang.String getContentType()
Returns the mime content type of this attachment.- Returns:
- the mime content type of this attachment.
- Since:
- 4.0.4
-
setContentType
void setContentType(java.lang.String contentType)
Sets the mime content type of this attachment.- Parameters:
contentType
- the content type to set.- Since:
- 4.0.4
-
getName
java.lang.String getName()
Returns the name of this attachment.- Returns:
- the name of this attachment.
- Since:
- 4.0.4
-
setName
void setName(java.lang.String name)
Sets the name of this attachment.- Parameters:
name
- the name value to set.- Since:
- 4.0.4
-
getDescription
java.lang.String getDescription()
Returns the description of this attachment.- Returns:
- the description of this attachment.
- Since:
- 4.0.4
-
setDescription
void setDescription(java.lang.String description)
Sets the description of this attachment.- Parameters:
description
- the description value to set.- Since:
- 4.0.4
-
getContent
java.sql.Blob getContent()
Returns the content of this attachment. The blob returned is valid only during the transaction that generated it.- Returns:
- the content of this attachment.
- Since:
- 4.0.4
-
getId
java.lang.String getId()
Returns a unique identifier for this attachment.- Returns:
- a unique identifier for this attachment.
- Since:
- 4.0.4
-
setContent
void setContent(java.io.InputStream inputStream, int length)
Sets the content for this mail attachment. The content will be read from the given input stream during the manager's send methods. So the input stream must stay opened until the send method is called.- Parameters:
inputStream
- the content input stream.- Since:
- 4.0.4
-
getContentInputStream
java.io.InputStream getContentInputStream()
Gets the content input stream for this mail attachment.- Parameters:
inputStream
- the content input stream.- Since:
- 4.0.4
-
getContentDispositionType
IMailAttachment.ContentDispositionType getContentDispositionType()
Returns the content disposition type set for this attachment.- Returns:
- the content disposition type set for this attachment.
- Since:
- 14.0.0
- See Also:
IMailAttachment#setContentDisposition
-
setContentDispositionType
void setContentDispositionType(IMailAttachment.ContentDispositionType disposition)
Sets the content disposition type for this attachment. By default content disposition type isIMailAttachment.ContentDispositionType.ATTACHMENT
.If the content disposition type is set to
IMailAttachment.ContentDispositionType.INLINE
, it may be referred in the HTML using the URIcid:content_identifier
, where content_identifier can be obtained fromgetContentId()
.For a more simple way to embed the attachment in the HTML body, see
embed()
.- Parameters:
disposition
- the content disposition type to set for this attachment.- Throws:
java.lang.NullPointerException
- ifdisposition
isnull
.- Since:
- 14.0.0
- See Also:
embed()
,getContentId()
-
embed
default java.lang.String embed()
Sets the content disposition type for this attachment toIMailAttachment.ContentDispositionType.INLINE
and returns the URI for referencing this attachment in its e-mail.Use example:
IMailBody mailBody = mail.getBody(); IMailAttachment attachedImage = ManagerFactory.getSendMailManager().createMailAttachment(); attachedImage.setContent(imageInputStream, imageLength); attachedImage.setContentType("image/png"); String imageURI = attachedImage.embed(); mailBody.getAttachments().add(attachedImage); mailBody.setHtmlMsg(""); - Returns:
- the URI for referencing this attachment in its e-mail.
- Since:
- 14.0.0
-
getContentId
java.lang.String getContentId()
Returns the content identifier used to construct the URI used refer to this attachment when it is inline.For a more simple way to embed the attachment in the HTML body, see
embed()
.- Returns:
- the content identifier.
- Since:
- 14.0.0
- See Also:
embed()
,setContentDispositionType(ContentDispositionType)
-
-