RT 4.0.25 Documentation

This version has reached its end of life and is out of support. Please contact us for upgrade assistance.


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


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

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

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