acs-mail-lite-procs.tcl

Provides a simple API for reliably sending email.

Location:
packages/acs-mail-lite/tcl/acs-mail-lite-procs.tcl
Created:
22 March 2002
Author:
Eric Lorenzo <eric@openforce.net>
CVS Identification:
$Id: acs-mail-lite-procs.tcl,v 1.108.2.34 2024/07/30 08:55:29 antoniop Exp $

Procedures in this file

Detailed information

acs_mail_lite::address_domain (private)

 acs_mail_lite::address_domain
Returns:
domain address to which bounces are directed to. If empty, uses domain from FixedSenderEmail parameter, otherwise the hostname in config.tcl is used.

Partial Call Graph (max 5 caller/called nodes):
%3 acs_mail_lite::bounce_address acs_mail_lite::bounce_address (private) acs_mail_lite::address_domain acs_mail_lite::address_domain acs_mail_lite::bounce_address->acs_mail_lite::address_domain acs_mail_lite::check_bounces acs_mail_lite::check_bounces (private) acs_mail_lite::check_bounces->acs_mail_lite::address_domain acs_mail_lite::generate_message_id acs_mail_lite::generate_message_id (private) acs_mail_lite::generate_message_id->acs_mail_lite::address_domain acs_mail_lite::unique_id_create acs_mail_lite::unique_id_create (private) acs_mail_lite::unique_id_create->acs_mail_lite::address_domain acs_mail_lite::unique_id_parse acs_mail_lite::unique_id_parse (private) acs_mail_lite::unique_id_parse->acs_mail_lite::address_domain parameter::get_from_package_key parameter::get_from_package_key (public) acs_mail_lite::address_domain->parameter::get_from_package_key

Testcases:
No testcase defined.

acs_mail_lite::configured_p (public)

 acs_mail_lite::configured_p

Determine, whether the outgoing SMTPHost is configured and reachable.

Partial Call Graph (max 5 caller/called nodes):
%3 acs_mail_lite::get_delivery_parameters acs_mail_lite::get_delivery_parameters (private) acs_mail_lite::configured_p acs_mail_lite::configured_p acs_mail_lite::configured_p->acs_mail_lite::get_delivery_parameters

Testcases:
No testcase defined.

acs_mail_lite::encode_email_address (private)

 acs_mail_lite::encode_email_address email
Parameters:
email (required)

Partial Call Graph (max 5 caller/called nodes):
%3 acs_mail_lite::send_immediately acs_mail_lite::send_immediately (private) acs_mail_lite::encode_email_address acs_mail_lite::encode_email_address acs_mail_lite::send_immediately->acs_mail_lite::encode_email_address mime::parseaddress mime::parseaddress acs_mail_lite::encode_email_address->mime::parseaddress mime::word_encode mime::word_encode acs_mail_lite::encode_email_address->mime::word_encode

Testcases:
No testcase defined.

acs_mail_lite::generate_message_id (private)

 acs_mail_lite::generate_message_id

Generate an id suitable as a Message-Id: header for an email.

Returns:
valid message-id for mail header

Partial Call Graph (max 5 caller/called nodes):
%3 acs_mail_lite::address_domain acs_mail_lite::address_domain (private) acs_mail_lite::generate_message_id acs_mail_lite::generate_message_id acs_mail_lite::generate_message_id->acs_mail_lite::address_domain

Testcases:
No testcase defined.

acs_mail_lite::get_address_array (private)

 acs_mail_lite::get_address_array -addresses addresses

Checks if passed variable is already an array of emails, user_names and user_ids. If not, get the additional data from the db and return the full array.

Switches:
-addresses (required)
Options:
-addresses
variable to checked for array
Returns:
array of emails, user_names and user_ids to be used for the mail procedures

Partial Call Graph (max 5 caller/called nodes):
%3 acs_mail_lite::parse_email_address acs_mail_lite::parse_email_address (private) db_0or1row db_0or1row (public) acs_mail_lite::get_address_array acs_mail_lite::get_address_array acs_mail_lite::get_address_array->acs_mail_lite::parse_email_address acs_mail_lite::get_address_array->db_0or1row

Testcases:
No testcase defined.

acs_mail_lite::get_delivery_parameters (private)

 acs_mail_lite::get_delivery_parameters

Get the SMTP Parameters and return these as a dict.

Returns:
dict with keys identical to the package parameters

Partial Call Graph (max 5 caller/called nodes):
%3 acs_mail_lite::configured_p acs_mail_lite::configured_p (public) acs_mail_lite::get_delivery_parameters acs_mail_lite::get_delivery_parameters acs_mail_lite::configured_p->acs_mail_lite::get_delivery_parameters acs_mail_lite::send_immediately acs_mail_lite::send_immediately (private) acs_mail_lite::send_immediately->acs_mail_lite::get_delivery_parameters acs_mail_lite::get_package_id acs_mail_lite::get_package_id (private) acs_mail_lite::get_delivery_parameters->acs_mail_lite::get_package_id parameter::get parameter::get (public) acs_mail_lite::get_delivery_parameters->parameter::get

Testcases:
No testcase defined.

acs_mail_lite::get_package_id (private)

 acs_mail_lite::get_package_id
Returns:
package_id of this package

Partial Call Graph (max 5 caller/called nodes):
%3 acs_mail_lite::get_delivery_parameters acs_mail_lite::get_delivery_parameters (private) acs_mail_lite::get_package_id acs_mail_lite::get_package_id acs_mail_lite::get_delivery_parameters->acs_mail_lite::get_package_id acs_mail_lite::get_parameter acs_mail_lite::get_parameter (public, deprecated) acs_mail_lite::get_parameter->acs_mail_lite::get_package_id acs_mail_lite::mail_dir acs_mail_lite::mail_dir (private) acs_mail_lite::mail_dir->acs_mail_lite::get_package_id acs_mail_lite::send acs_mail_lite::send (public) acs_mail_lite::send->acs_mail_lite::get_package_id acs_mail_lite::send_immediately acs_mail_lite::send_immediately (private) acs_mail_lite::send_immediately->acs_mail_lite::get_package_id apm_package_id_from_key apm_package_id_from_key (public) acs_mail_lite::get_package_id->apm_package_id_from_key

Testcases:
No testcase defined.

acs_mail_lite::get_parameter (public, deprecated)

 acs_mail_lite::get_parameter -name name [ -default default ]
Deprecated. Invoking this procedure generates a warning.

Returns an apm-parameter value of this package Deprecated: just a wrapper for parameter::get

Switches:
-name (required)
-default (optional)
Options:
-name
parameter name
-default
default parameter value
Returns:
apm-parameter value of this package
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 acs_mail_lite::get_package_id acs_mail_lite::get_package_id (private) ad_log_deprecated ad_log_deprecated (public) parameter::get parameter::get (public) acs_mail_lite::get_parameter acs_mail_lite::get_parameter acs_mail_lite::get_parameter->acs_mail_lite::get_package_id acs_mail_lite::get_parameter->ad_log_deprecated acs_mail_lite::get_parameter->parameter::get

Testcases:
No testcase defined.

acs_mail_lite::log_mail_sending (private)

 acs_mail_lite::log_mail_sending -user_id user_id

Logs mail sending time for user

Switches:
-user_id (required)
Options:
-user_id
user for whom email sending should be logged

Partial Call Graph (max 5 caller/called nodes):
%3 db_dml db_dml (public) db_resultrows db_resultrows (public) acs_mail_lite::log_mail_sending acs_mail_lite::log_mail_sending acs_mail_lite::log_mail_sending->db_dml acs_mail_lite::log_mail_sending->db_resultrows

Testcases:
No testcase defined.

acs_mail_lite::mail_dir (private)

 acs_mail_lite::mail_dir
Returns:
incoming mail directory to be scanned for bounces

Partial Call Graph (max 5 caller/called nodes):
%3 acs_mail_lite::maildir_check_incoming acs_mail_lite::maildir_check_incoming (private) acs_mail_lite::mail_dir acs_mail_lite::mail_dir acs_mail_lite::maildir_check_incoming->acs_mail_lite::mail_dir acs_mail_lite::scan_replies acs_mail_lite::scan_replies (public, deprecated) acs_mail_lite::scan_replies->acs_mail_lite::mail_dir acs_mail_lite::get_package_id acs_mail_lite::get_package_id (private) acs_mail_lite::mail_dir->acs_mail_lite::get_package_id parameter::get parameter::get (public) acs_mail_lite::mail_dir->parameter::get

Testcases:
No testcase defined.

acs_mail_lite::message_interpolate (private, deprecated)

 acs_mail_lite::message_interpolate -values values -text text
Deprecated. Invoking this procedure generates a warning.

Interpolates a set of values into a string. This is directly copied from the bulk mail package. DEPRECATED: duplicated code from bulk-mail that could be replaced by "string map"

Switches:
-values (required)
a list of key, value pairs, each one consisting of a target string and the value it is to be replaced with.
-text (required)
the string that is to be interpolated
Returns:
the interpolated string
See Also:
  • "string map"

Partial Call Graph (max 5 caller/called nodes):
%3 ad_log_deprecated ad_log_deprecated (public) acs_mail_lite::message_interpolate acs_mail_lite::message_interpolate acs_mail_lite::message_interpolate->ad_log_deprecated

Testcases:
No testcase defined.

acs_mail_lite::parse_email_address (private)

 acs_mail_lite::parse_email_address -email email

Extracts the email address out of a mail address (like Joe User <joe@user.com>)

Switches:
-email (required)
Options:
-email
mail address to be parsed
Returns:
only the email address part of the mail address

Partial Call Graph (max 5 caller/called nodes):
%3 acs_mail_lite::email_type acs_mail_lite::email_type (public) acs_mail_lite::parse_email_address acs_mail_lite::parse_email_address acs_mail_lite::email_type->acs_mail_lite::parse_email_address acs_mail_lite::get_address_array acs_mail_lite::get_address_array (private) acs_mail_lite::get_address_array->acs_mail_lite::parse_email_address acs_mail_lite::inbound_queue_insert acs_mail_lite::inbound_queue_insert (private) acs_mail_lite::inbound_queue_insert->acs_mail_lite::parse_email_address acs_mail_lite::load_mails acs_mail_lite::load_mails (public, deprecated) acs_mail_lite::load_mails->acs_mail_lite::parse_email_address callback::acs_mail_lite::incoming_email::impl::acs-mail-lite callback::acs_mail_lite::incoming_email::impl::acs-mail-lite (private, deprecated) callback::acs_mail_lite::incoming_email::impl::acs-mail-lite->acs_mail_lite::parse_email_address

Testcases:
No testcase defined.

acs_mail_lite::send (public)

 acs_mail_lite::send [ -send_immediately ] [ -valid_email ] \
    -to_addr to_addr -from_addr from_addr [ -subject subject ] \
    -body body [ -mime_type mime_type ] [ -cc_addr cc_addr ] \
    [ -bcc_addr bcc_addr ] [ -reply_to reply_to ] \
    [ -package_id package_id ] [ -no_callback ] [ -file_ids file_ids ] \
    [ -filesystem_files filesystem_files ] \
    [ -delete_filesystem_files ] [ -extraheaders extraheaders ] \
    [ -use_sender ] [ -object_id object_id ]

Prepare an email to be sent. Various email attributes can be specified, such as subject, body, senders, recipients, attachments and so on. The proc relies on MIME and SMTP.

Switches:
-send_immediately (optional, boolean)
The email is send immediately and not stored in the acs_mail_lite_queue
-valid_email (optional, boolean)
-to_addr (required)
List of e-mail addresses to send this mail to.
-from_addr (required)
E-Mail address of the sender.
-subject (optional)
of the email
-body (required)
Text body of the email
-mime_type (optional, defaults to "text/plain")
MIME Type of the mail to send out. Can be "text/plain", "text/html".
-cc_addr (optional)
List of CC Users e-mail addresses to send this mail to.
-bcc_addr (optional)
List of CC Users e-mail addresses to send this mail to.
-reply_to (optional)
-package_id (optional)
Package ID of the sending package
-no_callback (optional, boolean)
Boolean that indicates if callback should be executed or not. If you don't provide it it will execute callbacks
-file_ids (optional)
List of file ids (items or revisions) to be sent as attachments. This will only work with files stored in the file-storage.
-filesystem_files (optional)
List of regular files on the filesystem to be sent as attachments.
-delete_filesystem_files (optional, boolean)
-extraheaders (optional)
List of keywords and their values passed in for headers. Interesting ones are: "Precedence: list" to disable autoreplies and mark this as a list message. This is as list of lists !!
-use_sender (optional, boolean)
Boolean indicating that from_addr should be used regardless of fixed-sender parameter
-object_id (optional)

Partial Call Graph (max 5 caller/called nodes):
%3 test_email_send email_send (test acs-mail-lite) acs_mail_lite::send acs_mail_lite::send test_email_send->acs_mail_lite::send acs_mail_lite::get_package_id acs_mail_lite::get_package_id (private) acs_mail_lite::send->acs_mail_lite::get_package_id acs_mail_lite::send_immediately acs_mail_lite::send_immediately (private) acs_mail_lite::send->acs_mail_lite::send_immediately db_dml db_dml (public) acs_mail_lite::send->db_dml parameter::get parameter::get (public) acs_mail_lite::send->parameter::get acs_admin::check_expired_certificates acs_admin::check_expired_certificates (private) acs_admin::check_expired_certificates->acs_mail_lite::send acs_mail_lite::check_bounces acs_mail_lite::check_bounces (private) acs_mail_lite::check_bounces->acs_mail_lite::send acs_messaging_process_queue acs_messaging_process_queue (private) acs_messaging_process_queue->acs_mail_lite::send auth::local::password::ChangePassword auth::local::password::ChangePassword (private) auth::local::password::ChangePassword->acs_mail_lite::send auth::local::password::RetrievePassword auth::local::password::RetrievePassword (private) auth::local::password::RetrievePassword->acs_mail_lite::send

Testcases:
email_send

acs_mail_lite::send_immediately (private)

 acs_mail_lite::send_immediately [ -valid_email_p valid_email_p ] \
    -to_addr to_addr [ -cc_addr cc_addr ] [ -bcc_addr bcc_addr ] \
    -from_addr from_addr [ -reply_to reply_to ] [ -subject subject ] \
    -body body [ -package_id package_id ] [ -file_ids file_ids ] \
    [ -filesystem_files filesystem_files ] \
    [ -delete_filesystem_files_p delete_filesystem_files_p ] \
    [ -mime_type mime_type ] [ -no_callback_p no_callback_p ] \
    [ -extraheaders extraheaders ] [ -use_sender_p use_sender_p ] \
    [ -object_id object_id ] \
    [ -force_delivery_mode force_delivery_mode ]

Prepare an email to be sent immediately. Various email attributes can be specified, such as subject, body, senders, recipients, attachments and so on. The proc relies on MIME and SMTP.

Switches:
-valid_email_p (optional, defaults to "0")
-to_addr (required)
List of e-mail addresses to send this mail to.
-cc_addr (optional)
List of CC Users e-mail addresses to send this mail to.
-bcc_addr (optional)
List of CC Users e-mail addresses to send this mail to.
-from_addr (required)
E-Mail address of the sender.
-reply_to (optional)
E-Mail address to which replies should go. Defaults to from_addr
-subject (optional)
of the email
-body (required)
Text body of the email
-package_id (optional)
Package ID of the sending package
-file_ids (optional)
List of file ids (items or revisions) to be sent as attachments. This will only work with files stored in the file-storage.
-filesystem_files (optional)
List of regular files on the filesystem to be sent as attachments.
-delete_filesystem_files_p (optional, defaults to "0")
Decides if we want files specified by the 'file' parameter to be deleted once sent.
-mime_type (optional, defaults to "text/plain")
MIME Type of the mail to send out. Can be "text/plain", "text/html".
-no_callback_p (optional, defaults to "0")
Indicates if callback should be executed or not. If you don't provide it it will execute callbacks.
-extraheaders (optional)
List of keywords and their values passed in for headers. Interesting ones are: "Precedence: list" to disable autoreplies and mark this as a list message. This is as list of lists !!
-use_sender_p (optional, defaults to "0")
Boolean indicating that from_addr should be used regardless of fixed-sender parameter
-object_id (optional)
Object id that caused this email to be sent
-force_delivery_mode (optional)
Force the specified delivery mode for this single call

Partial Call Graph (max 5 caller/called nodes):
%3 acs_mail_lite::send acs_mail_lite::send (public) acs_mail_lite::send_immediately acs_mail_lite::send_immediately acs_mail_lite::send->acs_mail_lite::send_immediately acs_mail_lite::sweeper acs_mail_lite::sweeper (private) acs_mail_lite::sweeper->acs_mail_lite::send_immediately acs_mail_lite::bounce_address acs_mail_lite::bounce_address (private) acs_mail_lite::send_immediately->acs_mail_lite::bounce_address acs_mail_lite::encode_email_address acs_mail_lite::encode_email_address (private) acs_mail_lite::send_immediately->acs_mail_lite::encode_email_address acs_mail_lite::get_delivery_parameters acs_mail_lite::get_delivery_parameters (private) acs_mail_lite::send_immediately->acs_mail_lite::get_delivery_parameters acs_mail_lite::get_package_id acs_mail_lite::get_package_id (private) acs_mail_lite::send_immediately->acs_mail_lite::get_package_id acs_mail_lite::smtp acs_mail_lite::smtp (private) acs_mail_lite::send_immediately->acs_mail_lite::smtp

Testcases:
No testcase defined.

acs_mail_lite::smtp (private)

 acs_mail_lite::smtp -multi_token multi_token -headers headers \
    -originator originator -delivery_dict delivery_dict

Send messages via SMTP

Switches:
-multi_token (required)
Multi Token generated which is passed directly to smtp::sendmessage
-headers (required)
List of list of header key-value pairs like {{from malte@cognovis.de} {to malte@cognovis.de}}
-originator (required)
-delivery_dict (required)
dictionary of delivery parameters including the SMTP* configuration parameters

Partial Call Graph (max 5 caller/called nodes):
%3 acs_mail_lite::send_immediately acs_mail_lite::send_immediately (private) acs_mail_lite::smtp acs_mail_lite::smtp acs_mail_lite::send_immediately->acs_mail_lite::smtp

Testcases:
No testcase defined.

acs_mail_lite::sweeper (private)

 acs_mail_lite::sweeper

Send messages in the acs_mail_lite_queue table.

Partial Call Graph (max 5 caller/called nodes):
%3 acs_mail_lite::send_immediately acs_mail_lite::send_immediately (private) ad_log ad_log (public) ad_try ad_try (public) ad_url ad_url (public) db_dml db_dml (public) acs_mail_lite::sweeper acs_mail_lite::sweeper acs_mail_lite::sweeper->acs_mail_lite::send_immediately acs_mail_lite::sweeper->ad_log acs_mail_lite::sweeper->ad_try acs_mail_lite::sweeper->ad_url acs_mail_lite::sweeper->db_dml

Testcases:
No testcase defined.

acs_mail_lite::valid_signature (private)

 acs_mail_lite::valid_signature -signature signature \
    -message_id message_id

Validates if provided signature syntactically matches message_id as generated by OpenACS and equals to the hash of the provided signature. GN: not sure, why both is checked.

Switches:
-signature (required)
signature to be checked
-message_id (required)
message ID that the signature should be checked against
Returns:
boolean 0 or 1

Partial Call Graph (max 5 caller/called nodes):
%3

Testcases:
No testcase defined.

ns_sendmail (public, deprecated)

 ns_sendmail to from subject body [ extraheaders ] [ bcc ]
Deprecated. Invoking this procedure generates a warning.

Replacement for ns_sendmail for backward compatibility.

Parameters:
to (required)
from (required)
subject (required)
body (required)
extraheaders (optional)
bcc (optional)

Partial Call Graph (max 5 caller/called nodes):
%3 acs_mail_lite::send acs_mail_lite::send (public) ad_log_deprecated ad_log_deprecated (public) ns_sendmail ns_sendmail ns_sendmail->acs_mail_lite::send ns_sendmail->ad_log_deprecated

Testcases:
No testcase defined.
[ show source ]