RT 4.4.4 Documentation

RT::EmailParser

Go to latest version →

NAME

  RT::EmailParser - helper functions for parsing parts from incoming
  email messages

SYNOPSIS

DESCRIPTION

METHODS

new

Returns a new RT::EmailParser object

SmartParseMIMEEntityFromScalar Message => SCALAR_REF [, Decode => BOOL, Exact => BOOL ] }

Parse a message stored in a scalar from scalar_ref.

ParseMIMEEntityFromSTDIN

Parse a message from standard input

ParseMIMEEntityFromScalar $message

Takes either a scalar or a reference to a scalar which contains a stringified MIME message. Parses it.

Returns true if it wins. Returns false if it loses.

ParseMIMEEntityFromFilehandle *FH

Parses a mime entity from a filehandle passed in as an argument

ParseMIMEEntityFromFile

Parses a mime entity from a filename passed in as an argument

_PostProcessNewEntity

cleans up and postprocesses a newly parsed MIME Entity

_DetectAttachedEmailFiles

Email messages submitted as attachments will be processed as a nested email rather than an attached file. Users may prefer to treat attached emails as normal file attachments and not have them processed.

If TreatAttachedEmailAsFiles is selected, treat attached email files as regular file attachments. We do this by checking MIME entities that have email (message/) content types and also have a defined filename, indicating they are attachments.

See the extract_nested_messages documentation in in the MIME::Parser module for details on how it deals with nested email messages.

IsRTaddress ADDRESS

Takes a single parameter, an email address. Returns true if that address matches the RTAddressRegexp config option. Returns false, otherwise.

CullRTAddresses ARRAY

Takes a single argument, an array of email addresses. Returns the same array with any IsRTAddress()es weeded out.

LookupExternalUserInfo

 LookupExternalUserInfo is a site-definable method for synchronizing
 incoming users with an external data source. 

 This routine takes a tuple of EmailAddress and FriendlyName
    EmailAddress is the user's email address, ususally taken from
        an email message's From: header.
    FriendlyName is a freeform string, ususally taken from the "comment" 
        portion of an email message's From: header.

 It returns (FoundInExternalDatabase, ParamHash);

   FoundInExternalDatabase must  be set to 1 before return if the user 
   was found in the external database.

   ParamHash is a Perl parameter hash which can contain at least the 
   following fields. These fields are used to populate RT's users 
   database when the user is created.

    EmailAddress is the email address that RT should use for this user.  
    Name is the 'Name' attribute RT should use for this user. 
         'Name' is used for things like access control and user lookups.
    RealName is what RT should display as the user's name when displaying 
         'friendly' names

Return the parsed head from this message

Entity

Return the parsed Entity from this message

_SetupMIMEParser $parser

A private instance method which sets up a mime parser to do its job

ParseEmailAddress string

Returns a list of Email::Address objects Works around the bug that Email::Address 1.889 and earlier doesn't handle local-only email addresses (when users pass in just usernames on the RT system in fields that expect Email Addresses)

We don't handle the case of bob, fred@bestpractical.com because we don't want to fail parsing bob, "Falcone, Fred" <fred@bestpractical.com> The next release of Email::Address will have a new method we can use that removes the bandaid

CleanupAddresses ARRAY

Massages an array of Email::Address objects to make their email addresses more palatable.

Currently this strips off surrounding single quotes around ->address and modifies the Email::Address objects in-place.

Returns the list of objects for convienence in map/grep chains.

RescueOutlook

Outlook 2007/2010 have a bug when you write an email with the html format. it will send a 'multipart/alternative' with both 'text/plain' and 'text/html' in it. it's cool to have a 'text/plain' part, but the problem is the part is not so right: all the "\n" in your main message will become "\n\n" :/

this method will fix this bug, i.e. replaces "\n\n" to "\n". return 1 if it does find the problem in the entity and get it fixed.

LooksLikeMSEmail

Try to determine if the current email may have come from MS Outlook or gone through Exchange, and therefore may have extra newlines added.

← Back to index