Cosmic.voyage/Procmail

From Tildeverse Wiki
Revision as of 20:37, 7 February 2023 by Alexlehm (talk | contribs) (draft version)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Procmail

Cosmic supports running Procmail to filter your emails and sort them into folders. For info about the program please use man procmail and for the config file use man procmailrc. The program has a large number of rules and config options. To set up a basic filter, do the following.

Create a file ~/.forward with the line

   | /usr/bin/procmail

Create a file ~/.procmailrc with filter rules for the mails you want to put into folders, e.g. my current file looks like this:

```` LOGFILE=procmail.log MAILDIR=mail

0
  • ^From: tildebot@tilde.chat$

tildebot

0
  • ^From: git@tildegit.org$

tildegit

0
  • ^From: root@cosmic.voyage .Cron Daemon.$

cronjobs ````

This filters mails from the IRC bot into tildebot, the git mails into tildegit and mails from your local cronjobs into a folder cronjobs.

The folders are stored in ~/mail/name, which makes it possible to read them with alpine, also it is possible to use IMAP to subscribe, but for some reason that does not work immediately, there seems to be some kind of cache on that.

To write a filter recipe, it is useful to have a testmail to run each time to test the rule, you can simply use an example mail that you want to filter by saving it with alpine with the s key, the resulting file is a IMAP folder file, you can remove the first header that says don't delete and also remove the Delivered-To: line, otherwise the mail router will think the mail is looping, also you could remove the Date: header to give the mail a new date each time it is sent.

You can send the testmail with /usr/sbin/sendmail -t <mail.txt

The results of the filter operation are logged in ~/procmail.log