Forum OpenACS Development: Some notes about acs-mail-lite when upgrading

Hi everyone,

(Sorry if this re-iterates stuff that's already been discussed, but I thought I'd add a bit to the pool of knowledge.)

After upgrading from OACS 5.2 to 5.4 (I think) I've run into a lot of trouble with acs-mail-lite. Basically, the re-factored code for sending via smtp seems to be slightly buggy. It seems that the problem originates from tcllib 1.9, and upgrading to 1.10 solved the issue (I hope).

Some observations:

- There are two bug fixes currently in CVS for acs-mail-lite-procs.tcl and util-procs.tcl respectively. Both are important, but util-procs.tcl is necessary to use tcllib 1.9 at all.
- Once that problem was solved, the message was prepared correctly (all the mime::* stuff) but the actual sending didn't go over well. Changing "EmailDeliveryMode" in the aolserver config file to something like "ns_sendmail" with change the delivery method to ns_sendmail -- but that causes other problems since the bounce handling will fail and the mime token passed to ns_sendmail seems to be misread.
- The upgrade to acs-mail-lite introduces new parameters, notably SMTPHost et al. where the smtp host defaults to localhost. Since the hostname was retrieved from the aolserver config file in previous version, you'll need to remove the default value if you want to use a non-local smtp server.
- If you've already run acs_mail_lite::sweeper with faulty code after upgrading, you'll need to unlock the messages in the queue. Otherwise they won't be delivered. Unlocking should be done like this:
update acs_mail_lite_queue set locking_server = '';

After all of that, the advise is simple: Just upgrade to tcllib 1.10 if possible 😉

Relatedly, if you used weird hack to have acs-mail-lite push html mails in olden days, those hacks won't work any longer. I.e.:

set body_text [ad_html_to_text $body]
set message_data [build_mime_message $body_text $body]
set extra_headers [ns_set new]
ns_set put $extra_headers MIME-Version [ns_set get $message_data MIME-Version]
ns_set put $extra_headers Content-ID [ns_set get $message_data Content-ID]
ns_set put $extra_headers Content-Type [ns_set get $message_data Content-Type]
set message [ns_set get $message_data body]
acs_mail_lite::send \
-to_addr $to_addr \
-from_addr $from_addr \
-subject $subject \
-body $message \
-extraheaders $extra_headers

... should now simply be:

acs_mail_lite::send \
-to_addr $to_addr \
-from_addr $from_addr \
-subject $subject \
-body $message \
-mime_type "text/html"

(I'm posting this only because it came as a surprise to me.)