Forum OpenACS Development: Re: acs-mail-lite that receives email with attachments

Collapse
Posted by Benjamin Brink on
Hi Gustaf,

This revised version was coded to touch as few points in the prior code as possible. This is meant to avoid compatibility issues with an upgrade, while adding more flexible feature set that is consistent between connection types imap/MailDir and smtp/ns_sendmail.

There's only one point where an upgrade may require a change, and that is with the bounce feature.

If a system is relying on bounce, two ways are provided to fix it. The intervention is minimal, considering the flux of bounce code prior to this version, and the discussion of changes suggested to make to it in OpenACS wiki and forums.

The bounce issue should be remedied by adapting to the new callbacks or, by replacing the invoking of acs_mail_lite::parse_bounce_address with a new proc acs_mail_lite::inbound_email_context. The new proc will try to parse the old way, if there is a transition period where an email using the prior way is replied to and intercepted in the new way. The new callbacks use the new parse method, also.

Outbound email was only touched to standardize message-id and originator headers.



Diff'ing through the files of the prior version, here is a summary of the changes:

1. message-id header value is created and parsed using a more general system. ad_sign is used to sign message-id when integrity of package_id etc is passed to email.

2. originator header now uses the same value provided by message-id header.

3. Bounce address may now be a fixed sender email address. (Not default).

4. On server start, scheduled procs to process bounces automatically turn off after failing twice. This saves having to modify acs-mail-lite-init.tcl locally to change email configuration. Just change parameters etc and maybe restart server.

5. acs_mail_lite::parse_bounce_address is deprecated instead of trying to incorporate its logic into the new paradigm. It's replacement acs_mail_lite::inbound_email_context handles both prior and new cases.

6. The way of figuring out the email domain is standardized. Prior code uses multiple methods that could result in inconsistent values.

7. FixedSenderEmail parameter was added as an option in context of some code that relies on configuration and determining domain.

8. cases of 'file delete $var' were changed to 'file delete -- $var'

9. acs-mail-lite-callback-procs.tcl has new callbacks that provide more flexible integration with packages. Prior callbacks are unchanged (but may break without a minor fix. See item 5 in this list).

I should also mention that a good deal of time was spent parsing rfc's related to email to make sure that the new code is as flexible as possible to adapting to custom requirements considering the variety of ways email is used.

cheers,
Ben