I have an IPad that loads every email from my inbox immediately. Because of some spam in my mails I want to install an email cleaner/filter. I already tried spamassassin and some other self written python code on my raspi that find and deletes all spam mails each second from the server. The problem is that the emails altough they are deleted from the server my IPad still gets most of them.
My question is if there's a easy solution to avoid my IPad loading some of the spam before my program deletes it. That means that my IPad wouldn't even see the mails because they're filtered by any device in the network.
If anyone has the same problem...
This solution worked for me. I added a new email account to the mail server. On my IPad I use the IMAP server (for receiving) from the new account while the SMTP server (for sending) is the same as before. That means sending mails hasn't changed. I wrote a little python script that sends every non spam mail to the new account. It's running 24/7 on my raspi. That means that I now only see the mails I want to see while I can send mails like I'm used to it.
If you also want to write a program like this you should start looking up how to receive and send emails in your favorite language. 
Of course this works for every email client.
Deleting spam mails from inbox before mail client loads them