mailserver:checks

Configure the mail server access settings.

warden --task=mailserver:checks --oper=<header_add|header_del|body_add|body_del>
Option
Value Description
--oper <string> The operation you want to perform. Operations: header_add, header_del, body_add, body_del
--pattern <string> The pattern to match.
--action <string> The action. Actions: REJECT, OK, DUNNO, DISCARD, HOLD, REDIRECT, BCC, PREPEND, INFO, WARN
--text <string> You can optionally specify a short string of text to be used in the reply and with logging for this message; otherwise, Postfix uses the general reply code and text configured for the restriction.
--reload <yes> Reload the service after saving settings.

Examples

// reject mail with a specific subject
warden --task=mailserver:checks --oper=header_add --pattern='/^Subject: make money fast/i' --action=REJECT --text='Your subject is banned' --reload=yes

// remove header rule from above
warden --task=mailserver:checks --oper=header_del --pattern='/^Subject: make money fast/i' --reload=yes

// reject mail with a specific keyword in the body
warden --task=mailserver:checks --oper=body_add --pattern='/viagra/i' --action=REJECT --text='Your mail contains a banned keyword' --reload=yes

// remove body rule from above
warden --task=mailserver:checks --oper=body_del --pattern='/viagra/i' --reload=yes