[exim] How to archive outgoing mail to user's home directory…

Pàgina inicial
Delete this message
Reply to this message
Autor: spam
Data:  
A: exim-users
Assumpte: [exim] How to archive outgoing mail to user's home directory?
Our Exim server runs multiple users each of whom have multiple email
accounts across a couple of smarthosts. Incoming mail, fetched with
fetchmail, is added to /var/mail/<username> where a procmail script
copies it (twice) to a maildir under ~/mail/inbox/ and
~/mail/inbox/.archive.inbox/. This way each user has a complete record
of all incoming mail (in the archive) and can prune and (sub)file their
inbox as they see fit.

Everything in ~/mail/inbox/ is served by dovecot (IMAP) so each user can
access their mail with multiple different MUAs remotely.

This has worked wonderfully for a while now. However, I would also like
to archive all outgoing mail to ~/mail/inbox/.archive.outbox/ regardless
of whether the user decides to also save the mail via their MUA into
~/mail/inbox/.sent.

I know the users could achieve it via their MUA but not all support
saving sent mail to multiple mailboxes (e.g. mutt without the fcc
patch); and I want it to be independent of the MUA, outgoing mail*
should be archived regardless.

* = outgoing mail is defined by going through a smarthost (ideally).

So, how can I archive all outgoing mail to ~/mail/inbox/.archive.outbox/?

My attempt uses a system filter:

system_filter = /etc/exim/system.filter
system_filter_user = Debian-exim
system_filter_group = Debian-exim
system_filter_directory_transport = local_copy_outgoing

local_copy_outgoing:
driver = appendfile
delivery_date_add
envelope_to_add
return_path_add
maildir_format = true
create_directory = true

The system filter itself is as follows:
unseen save $home/mail/inbox/.archive.outbox/

It seems as if $home is empty (because of the user being set to
Debian-exim?) and thus nothing is saved.

$sender_ident looks promising but doesn't look like it will work with
MUAs using IMAP on a mobile device:
unseen save /home/$sender_ident/mail/inbox/archive.outbox/

$sender_ident: When a message is received from a remote host, this
variable contains the identification received in response to an RFC 1413
request.

I figure I must be able to get at the sending user as local SMTP
requires the user's username and password. Any help would be hugely
appreciated.