I think I’m going to give Rmail another try on Emacs. I’ll need MIME support and spam filtering, too.
enberg suggest SpamProbe.
sudo port install spamprobe
No problem.
sudo port install fetchmail +ssl
Results in an error:
---> Fetching fetchmail ---> Verifying checksum(s) for fetchmail ---> Extracting fetchmail ---> Applying patches to fetchmail Error: Target com.apple.patch returned: shell command "aclocal" returned error 1 Command output: aclocal: configure.in: 72: macro `AM_GNU_GETTEXT' not found in library
Some googling finds an email ¹ describing how to fix it:
cd /opt/local/var/db/dports/sources/rsync.rsync.opendarwin.org_dpupdate_dports/mail/fetchmail/ sudo vi Portfile
Now replace the following line:
system "aclocal"
With this one:
system "aclocal -I /opt/local/share/aclocal"
Now it works. 😄
For the moment, my .fetchmailrc file only contains the following:
defaults protocol pop3 mda "/usr/bin/procmail -d %T" poll mail.epfarms.org poll mail.thinkmo.de user "alex@emacswiki.org" ssl poll fencepost.gnu.org protocol apop fetchsizelimit 1
I needed to specify the MDA, because there is no service listening at the SMTP port. Therefore, fetchmail must deliver to procmail directly, and procmail will put the mails in my mail spool where Rmail will find them.
I use the *fetchsizelimit 1* setting for fencepost because if I don’t, I get the following error:
fetchmail: cannot get a range of message sizes (1-4). fetchmail: Klient/Server-Protokoll-Fehler beim Abholen von fencepost.gnu.org fetchmail: Abfragestatus=4 (PROTOCOL)
The username and password are from my .netrc file. It turns out that Emacs’s netrc.el will only parse entries correctly if you put them all on one line:
machine mail.epfarms.org login alex password mu machine mail.thinkmo.de login alex@emacswiki.org password mu machine fencepost.gnu.org login alex password mu
In my Emacs, I also reference my .netrc file:
(require 'smtpmail) (setq smtpmail-smtp-server "mail.epfarms.org" send-mail-function 'smtpmail-send-it smtpmail-auth-credentials "~/.netrc" smtpmail-debug-info t)
How do I run fetchmail on a regular basis? Installing fetchmail also installed DarwinPortsStartup. That runs all executable scripts ending in .sh in _opt_local/etc/rc.d with the start parameter.
1. start in daemon mode, poll every 15min @reboot fetchmail -d 900
This means
Integrate SpamProbe in .procmail:
0 SCORE=| /opt/local/bin/spamprobe train :0 wf | formail -I "X-SpamProbe: $SCORE" :0 a:
Note the unusual path of the executable. You might have to change that.
All spam mail will end up in the SPAM mbox file, now.
Setup RmailSpamprobe in .emacs:
(autoload 'rmail-spamprobe-retrain-dwim "rmail-spamprobe" nil t) (add-hook 'rmail-mode-hook (lambda () (define-key rmail-mode-map (kbd "$") 'rmail-spamprobe-retrain-dwim) (define-key rmail-summary-mode-map (kbd "$") 'rmail-spamprobe-retrain-dwim)))
This will bind the $ key to toggle spam/ham, retrain spamprobe, and deliver it again using procmail.
I also trained spamprobe on two of the ThunderBird folders I have: About 400 spam and 1880 from my archive of miscellaneous mails from 2005 – ie. no project-specific stuff.
For my MIME integration, I had to get the mimencode tool. It was not obvious where to get it. And there is no metamail in sight!
sudo port install mmencode
And then write some code myself. I’ve added that to RmailMime. But AlexanderPohoyda als wrote some MIME code...
#Software