Package lumis.portal.sendmail
Interface IMailAttachment
-
@StableMinor(version="14.0", sinceVersion="4.0") public interface IMailAttachment
Stores information about a mail attachment.- Since:
- 4.0.4
- Version:
- $Revision: 24477 $ $Date: 2021-04-28 11:30:36 -0300 (Wed, 28 Apr 2021) $
-
-
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 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.Blob
getContent()
Returns the content of this attachment.IMailAttachment.ContentDispositionType
getContentDispositionType()
Returns the content disposition type set for this attachment.String
getContentId()
Returns the content identifier used to construct the URI used refer to this attachment when it is inline.InputStream
getContentInputStream()
Gets the content input stream for this mail attachment.String
getContentType()
Returns the mime content type of this attachment.String
getDescription()
Returns the description of this attachment.String
getId()
Returns a unique identifier for this attachment.String
getName()
Returns the name of this attachment.void
setContent(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(String contentType)
Sets the mime content type of this attachment.void
setDescription(String description)
Sets the description of this attachment.void
setName(String name)
Sets the name of this attachment.
-
-
-
Method Detail
-
getContentType
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(String contentType)
Sets the mime content type of this attachment.- Parameters:
contentType
- the content type to set.- Since:
- 4.0.4
-
getName
String getName()
Returns the name of this attachment.- Returns:
- the name of this attachment.
- Since:
- 4.0.4
-
setName
void setName(String name)
Sets the name of this attachment.- Parameters:
name
- the name value to set.- Since:
- 4.0.4
-
getDescription
String getDescription()
Returns the description of this attachment.- Returns:
- the description of this attachment.
- Since:
- 4.0.4
-
setDescription
void setDescription(String description)
Sets the description of this attachment.- Parameters:
description
- the description value to set.- Since:
- 4.0.4
-
getContent
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
String getId()
Returns a unique identifier for this attachment.- Returns:
- a unique identifier for this attachment.
- Since:
- 4.0.4
-
setContent
void setContent(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
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:
NullPointerException
- ifdisposition
isnull
.- Since:
- 14.0.0
- See Also:
embed()
,getContentId()
-
embed
default 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
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)
-
-