OpenACS Mail Lite

Taken from http://openacs.org/doc/acs-mail-lite/ :


Acs Mail Lite handles sending of email via sendmail or smtp and includes a bounce management system for invalid email accounts.

When called to send a mail, the mail will either get sent immediately or placed in an outgoing queue (changeable via parameter) which will be processed every few minutes.

ACS Mail Lite uses either sendmail (you have to provide the location of the binary as a parameter) or SMTP to send the mail. If the sending fails, the mail will be placed in the outgoing queue again and be given another try a few minutes later when processing the queue again.

Each email contains an X-Envelope-From adress constructed as follows:
The adress starts with "bounce" (can be changed by a parameter) followed by the user_id, a hashkey and the package_id of the package instance that sent the email, separated by "-". The domain name of this adress can be changed with a parameter.

The system checks every 2 minutes (configurable) in a certain maildirectory (configurable) for newly bounced emails, so the mailsystem will have to place every mail to an address beginning with "bounce" (or whatever the appropriate parameter says) in that directory. The system then processes each of the bounced emails, strips out the message_id and verifies the hashkey in the bounce-address. After that the package-key of the package sending the original mail is found out by using the package_id provided in the bounce adress. With that, the system then tries to invoke a callback procedure via a service contract if one is registered for that particular package-key. This enables each package to deal with bouncing mails on their own - probably logging this in special tables. ACS Mail Lite then logs the event of a bounced mail of that user.

Every day a procedure is run that checks if an email account has to be disabled from receiving any more mail. This is done the following way:

  • If a user received his last mail X days ago without any further bounced mail then his bounce-record gets deleted since it can be assumed that his email account is working again and no longer refusing emails. This value can be changed with the parameter "MaxDaysToBounce".
  • If more then Y emails were returned by a particular user then his email account gets disabled from receiving any more mails from the system by setting the email_bouncing_p flag to t. This value can be changed with the parameter "MaxBounceCount".
  • To notify users that they will not receive any more mails and to tell them how to reenable the email account in the system again, a notification email gets sent every 7 days (configurable) up to 4 times (configurable) that contains a link to reenable the email account.
To use this system here is a quick guide how to do it with postfix.
  • Edit /etc/postfix/main.cf
    • Set "recipient_delimiter" to " - "
    • Set "home_mailbox" to "Maildir/"
    • Make sure that /etc/postfix/aliases is hashed for the alias database
  • Edit /etc/postfix/aliases. Redirect all mail to "bounce" (if you leave the parameter as it was) to "nsadmin" (in case you only run one server).

In case of multiple services on one system, create a bounce email for each of them (e.g. changeing "bounce" to "bounce_service1") and create a new user that runs the aolserver process for each of them. You do not want to have service1 deal with bounces for service2.

 

Package Documentation 

Procedure Files

tcl/acs-mail-lite-callback-procs.tcl       Callback procs for acs-mail-lite 
tcl/acs-mail-lite-procs.tcl       Provides a simple API for reliably sending email. 
tcl/apm-callback-procs.tcl       Installation procs for acs-mail-lite 
tcl/bounce-procs.tcl       Provides a simple API for reliably sending email. 
tcl/incoming-mail-procs.tcl       Provides a simple API for reliably sending email. 
tcl/utils-procs.tcl       Helper procs to build email messages 

Procedures

acs_mail_lite::address_domain        
acs_mail_lite::autoreply_p       Parse the subject, from and body to determin if the email is an auto reply Typical autoreplies are "Out of office" messages. 
acs_mail_lite::bounce_address       Composes a bounce address 
acs_mail_lite::bouncing_email_p       Checks if email address is bouncing mail 
acs_mail_lite::bouncing_user_p       Checks if email address of user is bouncing mail 
acs_mail_lite::generate_message_id       Generate an id suitable as a Message-Id: header for an email. 
acs_mail_lite::get_package_id        
acs_mail_lite::get_parameter       Returns an apm-parameter value of this package 
acs_mail_lite::parse_bounce_address       This takes a reply address, checks it for consistency, and returns a list of user_id, package_id and bounce_signature found 
acs_mail_lite::parse_email       An email is splitted into several parts: headers, bodies and files lists and all headers directly. 
acs_mail_lite::parse_email_address       Extracts the email address out of a mail address (like Joe User <joe@user.com>) 
acs_mail_lite::record_bounce       Records that an email bounce for this user 
acs_mail_lite::scan_replies       Scheduled procedure that will scan for bounced mails 
acs_mail_lite::send       Prepare an email to be send with the option to pass in a list of file_ids as well as specify an html_body and a mime_type. 
acs_mail_lite::utils::build_body       Encode the body using quoted-printable and build the alternative part if necessary Return a list of message tokens 
acs_mail_lite::utils::build_date       Depending on the available mime package version, it uses either the mime::parsedatetime to do it or local code (parsedatetime is buggy in mime < 1.5.2 ) 
acs_mail_lite::utils::build_subject       Encode the subject, using quoted-printable, of an email message and trim long lines. 
acs_mail_lite::utils::valid_email_p       Checks if the email is valid. 
acs_mail_lite::valid_signature       Validates if provided signature matches message_id 
callback::acs_mail_lite::email_form_elements::contract        
callback::acs_mail_lite::files::contract        
callback::acs_mail_lite::incoming_email::contract       Callback that is executed for incoming e-mails if the email is *NOT* like $object_id@servername 
callback::acs_mail_lite::incoming_email::impl::acs-mail-lite       Implementation of the interface acs_mail_lite::incoming_email for acs-mail-lite. 
callback::acs_mail_lite::incoming_object_email::contract       Callback that is executed for incoming e-mails if the email is like $object_id@servername 
callback::acs_mail_lite::send::contract       Callback for executing code after an email has been send using the send mechanism. 
ns_sendmail       Replacement for ns_sendmail for backward compability. 

SQL Files

sql/postgresql/acs-mail-lite-create.sql        
sql/postgresql/acs-mail-lite-drop.sql        
sql/postgresql/upgrade/acs-mail-lite-upgrade-0.1d-0.2a.sql        
sql/postgresql/upgrade/upgrade-5.4.0d1-5.4.0d2.sql        
sql/postgresql/upgrade/upgrade-5.4.0d2-5.4.0d3.sql        
sql/postgresql/upgrade/upgrade-5.8.1d3-5.8.1d4.sql        

Content Pages

www/
      restore-bounce.adp
      restore-bounce.tcl The page restores a user from the deleted state.

 

  Contact Us
  Project Open Business Solutions S.L.

Calle Aprestadora 19, 12o-2a

E-08907 Hospitalet de Llobregat (Barcelona)

 Tel Europe: +34 932 202 088
 Tel US: +1 415 429 5995
 Mail: info@project-open.com