Block spam interface

I had to make a small interface for a client who wants to be able to block spam. I couldn’t find a ready-made one or other option. If the approach is stupid, please tell me if there was an easier option without giving him access to the system.

Since I couldn’t find it anywhere and I only know PHP, I did it like this.

I set the interface to the client account

<?php if (!empty($_POST['textfield'])) { file_put_contents("spam.txt",$_POST['textfield']); } $content = file_get_contents("spam.txt"); ?>
<form method="post">
    <textarea name="textfield" style="width:500px; height:600px;"><?=$content?></textarea>
    <input type="submit" style="width:500px; padding:20px; margin:5px;" />

on the server I made a php that takes what the client writes, puts it in /etc/exim4/block and then restarts exim

<?php $c = file_get_contents("/home/admin/web/xxxxx/public_html/spam.txt"); $cc = file_get_contents("/etc/exim4/block"); $o1 = md5($c); $o2 = md5($cc); if($o1==$o2) { die("skip"); } file_put_contents("/etc/exim4/block",$c); shell_exec("systemctl restart exim4.service"); ?>

I set a cron 5 min
*/5 * * * * php /root/run.php >/dev/null 2>&1

I’m not sure about your code but there is already an option in Roundcube / Sieve to filter e-mails.
Another way is to use global exim4 blocking lists, like so:

I have setup three global blocking lists. One for tld’s, one for domains and one for specific e-mailaddresses.

Feel free to use it if it can help you.


There should be the possibility to add whitelists.

This could lead to a wonderful pull request.