This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Next revision Both sides next revision | ||
qmail [2009/05/12 14:06] k2patel |
qmail [2010/03/10 03:24] k2patel |
||
---|---|---|---|
Line 13: | Line 13: | ||
fi | fi | ||
</code> | </code> | ||
+ | |||
+ | ==== Block sender based .qmail (Bouncesaying) ==== | ||
+ | |||
+ | Here is the quick work around to block sender / domain using .qmail for user OR domain.\\ | ||
+ | * To disable "ketan@xyz.com" on domain "pqr.com" add code to file '.qmail-default' under domain directory | ||
+ | * To disable "ketan@xyz.com" on "info@pqr.com" add code to file '.qmail-info' under domain directory. | ||
+ | |||
+ | == To block sender : == | ||
+ | |||
+ | |||
+ | <code bash> | ||
+ | |||
+ | | if [ "${SENDER}" = "ketan@xyz.com" ]; then /var/qmail/bin/bouncesaying 'RESTRICTED: Domain policy disallows sending email to our domain.'; fi; | ||
+ | |||
+ | </code> | ||
+ | |||
+ | |||
+ | == To block Domain : == | ||
+ | |||
+ | Blocking xyz.com to send email to ketan@pqr.com | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | | /var/qmail/bin/bouncesaying 'RESTRICTED: Domain policy disallows sending email to our domain.' sh -c 'echo $SENDER | grep -qi "@xyz.com$"' | ||
+ | |||
+ | </code> | ||
+ | |||
+ | |||
+ | NOTE : | ||
+ | - This line must be appear first in file | ||
+ | - when you restrict for user you must add user Maildir line after this line. | ||
+ | e.g. "/usr/local/vpopmail/domains/9/W/pqr.com/info/Maildir/" |