pmgqm send with selected redirects

Mar 3, 2023
11
6
8
Hi

Mail Gateway 8.1.5.

We run a daily spam report using the default pmgspamreport.service. We have a handful of users who need their quarantine email redirected, but many (, many) others who do not. Is there a way to selectively redirect spam reports for certain accounts, without having to configure 1000s of individual 'pmgqm send --receiver ...'?

(Unfortunately, the spamreport templates only define the message body, otherwise I could fix it there)

Cheers
Toby
 
pmgsh has saved the day, again. We don't want our mailing lists getting spam reports, so I've replaced the pmgspamreport.service with a script + cronjob:

Code:
#!/bin/bash
# If one of our lists gets a spam email, send the spam report to admin, not the list.
redirect="--redirect admin@domain.dom"
pmgsh get /quarantine/quarusers | jq -r '.[].mail' | while read user; do
    if [[ $user =~ -list ]]; then
        pmgqm send --receiver $user --timespan yesterday $redirect
    else
        pmgqm send --receiver $user --timespan yesterday
    fi
done