• Publicity: Public Only All

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.

Testcases:
No testcase defined.

acs_mail_lite::configured_p (public)

 acs_mail_lite::configured_p

Determine, whether the outgoing SMTPHost is configured and reachable.

Testcases:
No testcase defined.

acs_mail_lite::encode_email_address (private)

 acs_mail_lite::encode_email_address email
Parameters:
email (required)

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

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

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

Testcases:
No testcase defined.

acs_mail_lite::get_package_id (private)

 acs_mail_lite::get_package_id
Returns:
package_id of this package

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:

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

Testcases:
No testcase defined.

acs_mail_lite::mail_dir (private)

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

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"

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

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)

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

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

Testcases:
No testcase defined.

acs_mail_lite::sweeper (private)

 acs_mail_lite::sweeper

Send messages in the acs_mail_lite_queue table.

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

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)

Testcases:
No testcase defined.
[ show source ]