NAME

  RT::Interface::CLI - helper functions for creating a commandline RT interface

SYNOPSIS

  use lib "!!RT_LIB_PATH!!";
  use lib "!!RT_ETC_PATH!!";
  use RT::Interface::Email  qw(Gateway CreateUser);

DESCRIPTION

METHODS

ParseCcAddressesFromHead HASHREF

Takes a hashref object containing QueueObj, Head and CurrentUser objects. Returns a list of all email addresses in the To and Cc headers b<except> the current Queue\'s email addresses, the CurrentUser\'s email address and anything that the configuration sub RT::IsRTAddress matches.

ParseSenderAddressFromHead

Takes a MIME::Header object. Returns a tuple: (user@host, friendly name) of the From (evaluated in order of Reply-To:, From:, Sender)

ParseErrorsToAddressFromHead

Takes a MIME::Header object. Return a single value : user@host of the From (evaluated in order of Errors-To:,Reply-To:, From:, Sender)

ParseAddressFromHeader ADDRESS

Takes an address from $head->get('Line') and returns a tuple: user@host, friendly name

Gateway ARGSREF

Takes parameters:

    action
    queue
    message

This performs all the "guts" of the mail rt-mailgate program, and is designed to be called from the web interface with a message, user object, and so on.

Returns:

    An array of:
    
    (status code, message, optional ticket object)
    status code is a numeric value.
    for temporary failures, status code should be -75
    for permanent failures which are handled by RT, status code should be 0
    
    for succces, the status code should be 1