SMTP Stream catching unapproved domains

Problem this snippet solves:

Use the default Stream profile and filter out mail to unapproved domains, and send to a bucket, the code is basic but the regex is very useful. 'mydomain' = the approved domain, everything else is matched.

Code :

when CLIENT_ACCEPTED {
log local0. "client accepted"
STREAM::expression {=RCPT TO:<[A-Za-z0-9._%+-]+@(?!(myOKDomain|myOtherOKDomain))[A-Za-z0-9.-]+\.[A-Za-z]{2,4}>=RCPT TO:=}
STREAM::enable
}
when STREAM_MATCHED {
log local0. "Stream filter matched: [STREAM::match]"
}
Published Mar 18, 2015
Version 1.0

Was this article helpful?

No CommentsBe the first to comment