one I wrote earlier this year but is really applicable to any similar set-up, with some modifications. The only configuration similarity this requires is that mail for all users is stored on the filesystem in the same place, rather than to separate locations i.e. each user having ~/.Maildir.
sudo apt-get install encfs
Once installed, you’ll need to make a directory for encrypted and decrypted mail to live.
sudo mkdir /var/mail/encrypted /var/mail/decrypted
You’ll need to set up permissions so your mail user can access the fuse device and the new directories.
For me, this user and group are called vmail but yours may be different.
sudo chgrp mail /var/mail/decrypted sudo g+rw /var/mail/decrypted sudo usermod -a -g fuse vmail sudo chgrp fuse /dev/fuse sudo chmod g+rw /dev/fuse