RT 5.0.5 Documentation


Go to latest version →


RT::Action::SendEmail - An Action which users can use to send mail or can subclassed for more specialized mail sending behavior. RT::Action::AutoReply is a good example subclass.


  use base 'RT::Action::SendEmail';


Basically, you create another module RT::Action::YourAction which ISA RT::Action::SendEmail.



Cleans class-wide options, like "AttachTickets".


Sends the prepared message and writes outgoing record into DB if the feature is activated in the config.


Builds an outgoing email we're going to send using scrip's template.


Returns an array of Email::Address objects containing all the To: recipients for this notification


Returns an array of Email::Address objects containing all the Cc: recipients for this notification


Returns an array of Email::Address objects containing all the Bcc: recipients for this notification

SendMessage MIMEObj

sends the message using RT's preferred API. TODO: Break this out to a separate module


Function (not method) that takes an RT::Transaction and returns an RT::Attachments collection of attachments suitable for attaching to an email.


Takes any attachments to this transaction and attaches them to the message we're building.


Add attachments requested by the transaction or template that aren't part of the transaction itself.

This inspects RT-Attach headers, which are expected to contain an RT::Attachment ID that the transaction's creator can See.

RT::Ticket-_RecordNote> accepts an AttachExisting argument which sets RT-Attach headers appropriately on Comment/Correspond.

AddAttachment $attachment

Takes one attachment object of RT::Attachment class and attaches it to the message we're building.

AttachTickets [@IDs]

Returns or set list of ticket's IDs that should be attached to an outgoing message.

Note this method works as a class method and setup things global, so you have to clean list by passing undef as argument.


Attaches tickets to the current message, list of tickets' ids get from "AttachTickets" method.

AddTicket $ID

Attaches a ticket with ID to the message.

Each ticket is attached as multipart entity and all its messages and attachments are attached as sub entities in order of creation, but only if transaction type is Create or Correspond.

RecordOutgoingMailTransaction MIMEObj

Record a transaction in RT with this outgoing message for future record-keeping purposes


This routine adds all the random headers that RT wants in a mail message that don't matter much to anybody else.


Returns list of the addresses to squelch on this transaction.


Remove addresses that are RT addresses or that are on this transaction's blacklist

RecipientFilter Callback => SUB, [All => 1]

Registers a filter to be applied to addresses by RemoveInappropriateRecipients. The Callback will be called with one address at a time, and should return false if the address should receive mail, or a message explaining why it should not be. Passing a true value for All will cause the filter to also be applied to NoSquelch (one-time Cc and Bcc) recipients as well.

SetReturnAddress is_comment => BOOLEAN

Calculate and set From and Reply-To headers based on the is_comment flag.

SetFrom ( From => emailaddress )

Set the From: address for outgoing email


Calculate the proper Friendly Name based on the creator of the transaction


Set the FIELD of the current MIME object into VALUE, which should be in characters, not bytes. Returns the new header, in bytes.


This routine sets the subject. it does not add the rt tag. That gets done elsewhere If subject is already defined via template, it uses that. otherwise, it tries to get the transaction's subject.


This routine fixes the RT tag in the subject. It's unlikely that you want to overwrite this.


Set References and In-Reply-To headers for this message.


Returns a fake Message-ID: header for the ticket to allow a base level of threading

SetHeaderAsEncoding($field_name, $charset_encoding)

This routine converts the field into specified charset encoding, then applies the MIME-Header transfer encoding.


Takes a perl string and optional encoding pass it over "EncodeToMIME" in RT::Interface::Email.

Basicly encode a string using B encoding according to RFC2047, returning bytes.

← Back to index