Optional features
By now you will have a fully functional email server. There are further features that you may want to use. Pick what you need.
Fetching and filtering using fetchmail and sieve
Mathias Geat wrote an article on integrating fetchmail and sieve that fits this setup.
Removing old deleted mails
With IMAP you can mark emails as deleted and some email clients will not even show them any more. But the emails are still there and occupy space. Usually there is an option to purge all marked emails but many users do not care. So Michael Weisgerber suggests to run this command frequently via crontab to remove such emails:
$> find /var/vmail -type f -ctime +7 -name '*,ST' -delete
Dovecot renames all deleted emails so that they get a ,ST added at the end of the filename. Adjust the parameter to -ctime as you like. In this example deleted mails older than 7 days are purged.
Comments
I find a easy way to use
I find a easy way to use fetchmail. But i dont know how to work with variables, so i "hardcoded" my idea :-). Just install fetchmail and create /var/vmail/.fetchmailrc You have to grant vmail own and 710 rights for .fetchmailrc put these lines into: #fetchmail.rc server mail.example.com proto pop3 user username pass password keep mda "/usr/lib/dovecot/deliver -d username@example.net" For me its easier to understand. I am a linux newbie ;-)
Some more info on a fitting fetchmail setup
It would be nice to have some more up-to-date info, on what's the best way to implement fetchmail into this mailserver setup. Looks like the info from the article of Mathias Geat is not suitable for the actual Lenny setup any more.
is it possible to use getmail ?
I would like to use getmail instead of fetchmail (in my opinion its better) - can anyone tell me how i can manage this ? Is it possible with only one user (vmail).
And is it possible to add a field to the mysql DB where you can chose for every email, if it has an antispam or an antivir protection ?
Removing old deleted mails
I prefer to use the following:
find /home/vmail -type f -ctime +7 -name *,ST -print0 | xargs -0 rm -f
this will work even if user has IMAP folders containing spaces (eg. "Junk E-mail")
Thanks
You are right. print0 is pretty important. Fixed it. Thank you.
Cleanup
To cleanup the spam-folder I use the following command:
find syntax
Since this is an HOWTO for Debain Lenny it's better to use all the facilities that a moder OS gives you.
So instead of using old/compatible syntax, you can use moder GNU find features like -delete
$ find /var/vmail -type f -ctime +7 -name '*,ST' -deleteit's the same, but in a more compact, clear and readable way
Thanks
Thanks for the hint. Honestly I wasn't aware that the find command nowadays has a -delete option. Very nice.
dovecot trash plugin
hi,
first of all:
thanks Christoph for this great tutorial. I managed to work it out and now have a functioning mail server.
As commented in the "prepare your system" I used PostgreSQL instead of MySQL and few other customizations,
since I don't fancy LAMP at all. if you want I can send you the additions for you to integrate them in this howto.
trash plugin:
There's an interesting dovecot plugin that works with quota and deletes folders' content based on your rules:
http://wiki.dovecot.org/Plugins/Trash
cheers