In exim, if the emails are getting stuck in the mail queue and you are getting the error:
unable to set gid=32009 or uid=32007 (euid=47): system filter
then you can perform the following steps to resolve this issue:
1. check the exim maillog /var/log/exim_mainlog
tailf /var/log/exim_mainlog
error: unable to set gid=32009 or uid=32007 (euid=47): system filter
2. Check the permission of /usr/sbin/exim
ls -la /usr/sbin/exim
3. Check whether the SUID permission is given to the file, if not set SUID permission.
chmod u+s /usr/sbin/exim
4. Restart exim service
service exim restart
5. Now you may check the log file and you can see the mails in the mail queue getting delivered.
6. Check the mail queue
exim -bpc
I hope that the article was helpful.