use RT::Attachment;
This module should never be instantiated directly by client code. it's an internal module which should only be instantiated through exported APIs in Ticket, Queue and other similar objects.
Create a new attachment. Takes a paramhash:
'Attachment' Should be a single MIME body with optional subparts
'Parent' is an optional id of the parent attachment
'TransactionId' is the mandatory id of the transaction this attachment is associated with.;
Returns the transaction object asscoiated with this attachment.
Returns a parent's RT::Attachment object if this attachment has a parent, otherwise returns undef.
Takes a MIME type as a string or regex. Returns an RT::Attachment object for the nearest containing part with a matching "ContentType". Strings must match exactly and all matches are done case insensitively. Strings ending in a /
must only match the first part of the MIME type. For example:
# Find the nearest multipart/* container
my $container = $attachment->Closest("multipart/");
Returns undef if no such object is found.
Returns an RT::Attachments object which is preloaded with all attachments objects with this attachment's Id as their Parent
.
Returns an RT::Attachments object containing all the attachments sharing the same immediate parent as the current object, excluding the current attachment itself.
If the current attachment is a top-level part (i.e. Parent == 0) then a guaranteed empty RT::Attachments object is returned.
Returns the attachment's content. if it's base64 encoded, decode it before returning it.
Returns the attachment's content as octets before RT's mangling. Generally this just means restoring text content back to its original encoding.
If the attachment has a message/*
Content-Type, its children attachments are reconstructed and returned as a string.
Returns the attachment's original encoding.
Returns length of "Content" in bytes.
Returns "ContentLength" in bytes, kilobytes, or megabytes as most appropriate. The size is suffixed with MiB
, KiB
, or B
and the returned string is localized.
Returns the empty string if the "ContentLength" is 0 or undefined.
Returns MIME entity built from this attachment.
If the optional parameter Children
is set to a true value, the children are recursively added to the entity.
Returns a boolean indicating if the Content-Type of this attachment is a message/
subtype.
Returns a boolean indicating if the Content-Disposition of this attachment is a MIME attachment.
Returns a hashref of all addresses related to this attachment. The keys of the hash are From
, To
, Cc
, Bcc
, RT-Send-Cc
and RT-Send-Bcc
. The values are references to lists of Email::Address objects.
Returns a multi-line string of the To, From, Cc, Date and Subject headers.
Returns this object's headers as a string. This method specifically removes the RT-Send-Bcc: header, so as to never reveal to whom RT sent a Bcc. We need to record the RT-Send-Cc and RT-Send-Bcc values so that we can actually send out mail. The mailing rules are separated from the ticket update code by an abstraction barrier that makes it impossible to pass this data directly.
Takes encoding as argument and returns the attachment's headers as octets in encoded using the encoding.
This is not protection using quoted printable or base64 encoding.
Returns the value of the first header Tag as a string. This bypasses the weeding out done in Headers() above.
Returns a list of all values for the the given header tag, in the order they appear.
Delete a field from the attachment's headers.
Add one or many fields to the attachment's headers.
Replace or add a Header to the attachment's headers.
Search the attachments table's Header column for the search string provided. When a match is found call the SetHeader() method on the header with the match, either set the header to empty or a replacement value.
Search the attachments table's Content column for the search string provided. When a match is found either replace it with the provided replacement string or an empty string.
Returns an array of this attachment object's headers, with one header per array entry. Multiple lines are folded.
Never returns RT-Send-Bcc
field.
Returns an array of this attachment object's headers, with one header per array entry. multiple lines are folded.
Returns the parsed status from the X-RT-GnuPG-Status or X-RT-SMIME-Status header.
The return value is an array of hashrefs; each hashref is as described in RT::Crypt::ParseStatus; however, each hashref has one additional entry 'Protocol' which is the name of the crypto protocol used and is one of 'SMIME' or 'GnuPG'.
If no crypto header exists, returns an empty array
Takes the name of a table column. Returns its value as a string, if the user passes an ACL check
Returns the current value of id. (In the database, id is stored as int(11).)
Returns the current value of TransactionId. (In the database, TransactionId is stored as int(11).)
Set TransactionId to VALUE. Returns (1, 'Status message') on success and (0, 'Error Message') on failure. (In the database, TransactionId will be stored as a int(11).)
Returns the current value of Parent. (In the database, Parent is stored as int(11).)
Set Parent to VALUE. Returns (1, 'Status message') on success and (0, 'Error Message') on failure. (In the database, Parent will be stored as a int(11).)
Returns the current value of MessageId. (In the database, MessageId is stored as varchar(160).)
Set MessageId to VALUE. Returns (1, 'Status message') on success and (0, 'Error Message') on failure. (In the database, MessageId will be stored as a varchar(160).)
Returns the current value of Subject. (In the database, Subject is stored as varchar(255).)
Set Subject to VALUE. Returns (1, 'Status message') on success and (0, 'Error Message') on failure. (In the database, Subject will be stored as a varchar(255).)
Returns the current value of Filename. (In the database, Filename is stored as varchar(255).)
Set Filename to VALUE. Returns (1, 'Status message') on success and (0, 'Error Message') on failure. (In the database, Filename will be stored as a varchar(255).)
Returns the current value of ContentType. (In the database, ContentType is stored as varchar(80).)
Set ContentType to VALUE. Returns (1, 'Status message') on success and (0, 'Error Message') on failure. (In the database, ContentType will be stored as a varchar(80).)
Returns the current value of ContentEncoding. (In the database, ContentEncoding is stored as varchar(80).)
Set ContentEncoding to VALUE. Returns (1, 'Status message') on success and (0, 'Error Message') on failure. (In the database, ContentEncoding will be stored as a varchar(80).)
Returns the current value of Content. (In the database, Content is stored as longblob.)
Set Content to VALUE. Returns (1, 'Status message') on success and (0, 'Error Message') on failure. (In the database, Content will be stored as a longblob.)
Returns the current value of Headers. (In the database, Headers is stored as longtext.)
Set Headers to VALUE. Returns (1, 'Status message') on success and (0, 'Error Message') on failure. (In the database, Headers will be stored as a longtext.)
Returns the current value of Creator. (In the database, Creator is stored as int(11).)
Returns the current value of Created. (In the database, Created is stored as datetime.)
← Back to index