{ pkgs, lib, ... }:
{
  services.rspamd.workers.controller.bindSockets = [{
    socket = "/run/rspamd/worker-controller.sock";
    mode = "0660";
  }];
  services.rspamd.locals = {
    "maps.d/spf_whitelist.inc.local" = {
      text = ''
        epicgames.com
        dmail.ai
      '';
    };
    "maps.d/spf_dkim_whitelist.inc.local" = {
      text = ''
        epicgames.com
        dmail.ai
      '';
    };
    "maps.d/dmarc_whitelist.inc.local" = {
      text = ''
        epicgames.com
        dmail.ai
      '';
    };
    "greylist-whitelist-domains.inc" = {
      text = ''
        dmail.ai
        epicgames.com
      '';
    };
  };
  services.rspamd.extraConfig = ''
    actions {
      reject = null;
      greylist = 4; # Apply greylisting when reaching this score
      add_header = 4; # Add header when reaching this score
    }
  '';
}