10 Agustus 2008

Sendmail bloking berdasar isi header email atau isi email (3)

Berikut contoh rules milter-regex kalau menginginkan memblok email di sendmail berdasar TO atau CC, From, Subject, User-Agent, List-Id dan juga isi messagenya.

Semua message menggunakan kata-kata "Undisclosed" di TO atau CC:

#Reject base on recipients
reject "Sorry, Recipients address not allowed :-p"
header /^To$/i /Undisclosed/i
header /^Cc$/i /Undisclosed/i

Semua message dari info@spamdomain.com:

#Reject base on From
reject "Sorry, Sender address not allowed :-p"
envfrom /info@spamdomain\.com/i

Semua message mengandung kata-kata "test" di subjectnya:

#Reject base on Subject
reject "Sorry, The subject not allowed :-p"
header /^Subject$/i /test/i

Semua message dari software IncredibleMail:


#Reject base on User-Agent
reject "Sorry, User-Agent not allowed :-p"
header /^User-Agent$/i /Incredible/i

Semua message dari mailing list yang nama mailing listnya mengandung kata-kata "test" :

#Reject base on List-Id
reject "Sorry, This mailing list not allowed :-p"
header /^List-Id$/i /test/i

Semua message yang isinya mengandung kata-kata "Cialis":

#Reject base on content message
reject "Sorry, This content messag not allowed :-p"
body /cialis/i


Juga bisa digabung seperti ini. Misal subject yg jorok-jorok direject kecuali user lokal network saja yang bisa.

localnetwork = connect // /192\.168\.1\.*/

#Reject base on Subject
reject "Sorry, Bad subject ... "
header /^Subject$/i /fuck/i and not $localnetwork
header /^Subject$/i /viagra/i
and not $localnetwork
header /^Subject$/i /cialis/i and not $localnetwork
header /^Subject$/i /nude/i and not $localnetwork

Goodluck pren

Tidak ada komentar: