As lamagra said you must replace:
antispam_pipe_program = /usr/bin/sa-learn
by
antispam_pipe_program = /usr/bin/sa-learn-pipe.sh
and create the following sa-learn-pipe.sh file in /usr/bin/ (ex: sudo nano /usr/bin/sa-learn-pipe.sh)
Write the following code:
#!/bin/bash
echo /usr/bin/sa-learn $* /tmp/sendmail-msg-$$.txt echo "$$-start ($*)" >> /tmp/sa-learn-pipe.log
#echo $* > /tmp/sendmail-parms.txt cat<&0 >> /tmp/sendmail-msg-$$.txt
/usr/bin/sa-learn $* /tmp/sendmail-msg-$$.txt && rm -f /tmp/sendmail-msg-$$.txt &
echo "$$-end" >> /tmp/sa-learn-pipe.log
exit 0
Save the file (CTRL+o then CTRL+x)
Then make it executable:
sudo chmod +x /usr/bin/sa-learn-pipe.sh
Restart dovecot
sudo service dovecot restart
Tell me if it works as expected (Tested on Ubuntu 14.xx)
Source:
http://wiki2.dovecot.org/Plugins/Antispam