• Publicity: Public Only All

email-inbound-procs.tcl

Provides API for importing email under a variety of deployment conditions.

Location:
packages/acs-mail-lite/tcl/email-inbound-procs.tcl
Created:
19 Jul 2017
CVS Identification:
$Id: email-inbound-procs.tcl,v 1.15.2.17 2023/07/10 09:16:39 gustafn Exp $

Procedures in this file

Detailed information

acs_mail_lite::email_type (public)

 acs_mail_lite::email_type [ -subject subject ] [ -from from ] \
    [ -headers headers ] [ -header_arr_name header_arr_name ] \
    [ -reply_too_fast_s reply_too_fast_s ] \
    [ -check_subject_p check_subject_p ]

Scans email's subject, from and headers for actionable type.

Returns actionable type and saves same type in header_arr_name(aml_type), and saves some normalized header info to reduce redundant processing downstream. See code comments for details.

Actional types: 'auto_gen' 'auto_reply', 'bounce', 'in_reply_to' or empty string indicating 'other' type.

  • 'auto_reply' may be a Delivery Status Notification for example.
  • 'bounce' is a specific kind of Delivery Status Notification.
  • 'in_reply_to' is an email reporting to originate from local email, which needs to be tested further to see if OpenACS needs to act on it versus a reply to a system administrator email for example.
  • 'auto_gen' is an auto-generated email that does not qualify as 'auto_reply', 'bounce', or 'in_reply_to'
  • '' (Empty string) refers to email that the system does not recognize as a reply of any kind. If not a qualifying type, returns empty string.
Adds these index to headers array:
  • received_cs: the received time of email in tcl clock epoch time.
  • aml_type: the same value returned by this proc.

If additional headers not calculated, they have value of empty string.

If headers and header_arr_name provided, only header_arr_name will be used, if header_arr_name contains at least one value.

If check_subject_p is set 1, checks for common subjects identifying autoreplies. This is not recommended to rely on exclusively. This feature provides a framework for extending classification of emails for deployment routing purposes.

If array includes keys from 'ns_imap struct', such as internaldate.*, then adds header with epoch time quivilent to header index received_cs

Switches:
-subject (optional)
of email
-from (optional)
of email
-headers (optional)
of email, a block of text containing all headers and values
-header_arr_name (optional)
-reply_too_fast_s (optional, defaults to "10")
-check_subject_p (optional, defaults to "0")
Set to 1 to check email subject.

Partial Call Graph (max 5 caller/called nodes):
%3 test_acs_mail_lite_inbound_procs_check acs_mail_lite_inbound_procs_check (test acs-mail-lite) acs_mail_lite::email_type acs_mail_lite::email_type test_acs_mail_lite_inbound_procs_check->acs_mail_lite::email_type acs_mail_lite::imap_conn_set acs_mail_lite::imap_conn_set (private) acs_mail_lite::email_type->acs_mail_lite::imap_conn_set acs_mail_lite::inbound_filters acs_mail_lite::inbound_filters (private) acs_mail_lite::email_type->acs_mail_lite::inbound_filters acs_mail_lite::parse_email_address acs_mail_lite::parse_email_address (private) acs_mail_lite::email_type->acs_mail_lite::parse_email_address acs_mail_lite::sched_parameters acs_mail_lite::sched_parameters (public) acs_mail_lite::email_type->acs_mail_lite::sched_parameters ad_outgoing_sender ad_outgoing_sender (public) acs_mail_lite::email_type->ad_outgoing_sender acs_mail_lite::imap_check_incoming acs_mail_lite::imap_check_incoming (private) acs_mail_lite::imap_check_incoming->acs_mail_lite::email_type acs_mail_lite::maildir_check_incoming acs_mail_lite::maildir_check_incoming (private) acs_mail_lite::maildir_check_incoming->acs_mail_lite::email_type

Testcases:
acs_mail_lite_inbound_procs_check

acs_mail_lite::inbound_prioritize (public)

 acs_mail_lite::inbound_prioritize \
    [ -header_array_name header_array_name ] \
    [ -size_chars size_chars ] [ -received_cs received_cs ] \
    [ -subject subject ] [ -package_id package_id ] \
    [ -party_id party_id ] [ -object_id object_id ]

Returns a prioritization integer for assigning priority to an inbound email. Another proc processes in order of lowest number first. Returns empty string if input values from email are not expected types. Priority has 3 categories: high priority, normal priority, low priority as specified in acs_mail_lite::sched_parameters Expects parameters to be passed within an array, or individually. When passing via an array, parameter names have suffix "aml_". For example, size_chars becomes aml_size_chars. Array values take precedence, if they exist.

Switches:
-header_array_name (optional)
-size_chars (optional)
of email
-received_cs (optional)
seconds since epoch when email received
-subject (optional)
of email
-package_id (optional)
associated with email (if any)
-party_id (optional)
associated with email (if any)
-object_id (optional)
associated with email (if any)
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 test_acs_mail_lite_inbound_procs_check acs_mail_lite_inbound_procs_check (test acs-mail-lite) acs_mail_lite::inbound_prioritize acs_mail_lite::inbound_prioritize test_acs_mail_lite_inbound_procs_check->acs_mail_lite::inbound_prioritize acs_mail_lite::sched_parameters acs_mail_lite::sched_parameters (public) acs_mail_lite::inbound_prioritize->acs_mail_lite::sched_parameters f::lmax f::lmax (public) acs_mail_lite::inbound_prioritize->f::lmax f::max f::max (public) acs_mail_lite::inbound_prioritize->f::max f::min f::min (public) acs_mail_lite::inbound_prioritize->f::min acs_mail_lite::imap_check_incoming acs_mail_lite::imap_check_incoming (private) acs_mail_lite::imap_check_incoming->acs_mail_lite::inbound_prioritize acs_mail_lite::maildir_check_incoming acs_mail_lite::maildir_check_incoming (private) acs_mail_lite::maildir_check_incoming->acs_mail_lite::inbound_prioritize

Testcases:
acs_mail_lite_inbound_procs_check

acs_mail_lite::sched_parameters (public)

 acs_mail_lite::sched_parameters [ -sredpcs_override sredpcs_override ] \
    [ -reprocess_old_p reprocess_old_p ] \
    [ -max_concurrent max_concurrent ] \
    [ -max_blob_chars max_blob_chars ] [ -mpri_min mpri_min ] \
    [ -mpri_max mpri_max ] [ -hpri_package_ids hpri_package_ids ] \
    [ -lpri_package_ids lpri_package_ids ] \
    [ -hpri_party_ids hpri_party_ids ] \
    [ -lpri_party_ids lpri_party_ids ] \
    [ -hpri_subject_glob hpri_subject_glob ] \
    [ -lpri_subject_glob lpri_subject_glob ] \
    [ -hpri_object_ids hpri_object_ids ] \
    [ -lpri_object_ids lpri_object_ids ] \
    [ -reject_on_hit reject_on_hit ] \
    [ -reject_on_miss reject_on_miss ]

Returns a name value list of parameters used by ACS Mail Lite scheduled procs. If a parameter is passed with value, the value is assigned to parameter.

Switches:
-sredpcs_override (optional)
If set, use this instead of si_dur_per_cycle_s. See www/doc/analysis-notes
-reprocess_old_p (optional)
If set, does not ignore prior unread email
-max_concurrent (optional)
Max concurrent processes to import (fast priority)
-max_blob_chars (optional)
Email body parts larger are stored in a file.
-mpri_min (optional)
Minimum threshold integer for medium priority. Smaller is fast High priority.
-mpri_max (optional)
Maximum integer for medium priority. Larger is Low priority.
-hpri_package_ids (optional)
List of package_ids to process at fast priority.
-lpri_package_ids (optional)
List of package_ids to process at low priority.
-hpri_party_ids (optional)
List of party_ids to process at fast/high priority.
-lpri_party_ids (optional)
List of party_ids to process at low priority.
-hpri_subject_glob (optional)
When email subject matches, flag as fast priority.
-lpri_subject_glob (optional)
When email subject matches, flag as low priority.
-hpri_object_ids (optional)
List of object_ids to process at fast/high priority.
-lpri_object_ids (optional)
List of object_ids to process at low priority.
-reject_on_hit (optional)
Name/Value list. See acs_mail_lite::inbound_filters
-reject_on_miss (optional)
Name/Value list. See acs_mail_lite::inbound_filters
Options:
-sched_parameter
value

Partial Call Graph (max 5 caller/called nodes):
%3 test_acs_mail_lite_inbound_procs_check acs_mail_lite_inbound_procs_check (test acs-mail-lite) acs_mail_lite::sched_parameters acs_mail_lite::sched_parameters test_acs_mail_lite_inbound_procs_check->acs_mail_lite::sched_parameters db_0or1row db_0or1row (public) acs_mail_lite::sched_parameters->db_0or1row db_dml db_dml (public) acs_mail_lite::sched_parameters->db_dml db_transaction db_transaction (public) acs_mail_lite::sched_parameters->db_transaction f::even_p f::even_p (public) acs_mail_lite::sched_parameters->f::even_p acs_mail_lite::email_type acs_mail_lite::email_type (public) acs_mail_lite::email_type->acs_mail_lite::sched_parameters acs_mail_lite::imap_email_parse acs_mail_lite::imap_email_parse (private) acs_mail_lite::imap_email_parse->acs_mail_lite::sched_parameters acs_mail_lite::inbound_filters acs_mail_lite::inbound_filters (private) acs_mail_lite::inbound_filters->acs_mail_lite::sched_parameters acs_mail_lite::inbound_prioritize acs_mail_lite::inbound_prioritize (public) acs_mail_lite::inbound_prioritize->acs_mail_lite::sched_parameters acs_mail_lite::inbound_queue_insert acs_mail_lite::inbound_queue_insert (private) acs_mail_lite::inbound_queue_insert->acs_mail_lite::sched_parameters

Testcases:
acs_mail_lite_inbound_procs_check
[ show source ]