I've seen quite a few postings on how to block subjects without neither
procmail nor milter:
LOCAL_CONFIG
Kparsesubject regex -S -a@MATCH Here you (have|go|are), :o\)
HSubject: $>CheckSubject
LOCAL_RULESETS
SCheckSubject
R$* $: $(parsesubject $&{currHeader} $: <OK> $)
R<OK> $@ OK
R$*@MATCH $#error $: 553 I do not like the subject
for example.
Is there anyway I can grab a copy of the rejected (or discarded, if I
choose to do that) email? I'm running sendmail 8.10.2.
Brgds
/Ole
> for example.
Not within sendmail.
It can be easily done with procmail or milter...
Thank-you for the clarification. That's what I suspected.
This is the problem I'm trying to solve:
I'm getting inbound emails to a list of users, where I know the most of
them on beforehand, with a subject which I also know.
I need to stop the email getting to those users and I need to keep a
copy of the email.
My plan is, then (when I can not discard and keep the message at the
same time), to make a
specificuser@mydomain local
mydomain smtp:internal.mail.relay
on the external mail gateway, thereby grapping the copy of the email I
need, and letting all the others continue into the company to the
internal mail relay.
On the internal mail relay I will then match the subject and discard all
the messages. That should work, I guess.
Now - next problem is that I only run sendmail 8.9.2 on the internal
mail relays.
They do support
$ /usr/lib/sendmail -bt -d0
Version 8.9.2
Compiled with: MAP_REGEX LOG MATCHGECOS MIME7TO8 MIME8TO7 NAMED_BIND
NDBM NETINET NETUNIX NEWDB NIS NISPLUS QUEUE SCANF SMTP
USERDB XDEBUG
Its sendmail.mc looks like this:
VERSIONID(`@(#)mail-gw.mc')
OSTYPE(solaris2.ml)dnl
DOMAIN(generic)dnl
define(`confDONT_BLAME_SENDMAIL',`forwardfileinunsafedirpathsafe,forwardfileinunsafedirpath')dnl
define(`confCF_VERSION', `mail-gw-v1.6')dnl
define(`confLOG_LEVEL', `13')dnl
define(`SMART_HOST',`smtp:mailgw-int.mydomain')dnl
define(`ALIAS_FILE', `/etc/mail/aliases')dnl
define(QUEUE_DIR, /var/spool/mqueue)dnl
define(confMAX_MESSAGE_SIZE,50000000)dnl
define(`confFORWARD_PATH', `/var/mail/$u-forward')dnl
define(`confCW_FILE', `/etc/mail/sendmail.cw')dnl
define(`LUSER_RELAY',`luserrelay.mydomain')dnl
define(`confMATCH_GECOS',False)dnl
define(`confUSERDB_SPEC',/etc/mail/userdb.db)dnl
define(`confSINGLE_LINE_FROM_HEADER',true)dnl
define(`confPRIVACY_FLAGS',`restrictmailq,restrictqrun')dnl
define(`LOCAL_MAILER_PATH',`/usr/lib/mail.local')dnl
define(`LOCAL_MAILER_FLAGS',`fSmn9')dnl
define(`LOCAL_MAILER_ARGS',`mail.local -d $u')dnl
FEATURE(`use_cw_file')dnl
FEATURE(`redirect')dnl
FEATURE(`always_add_domain')dnl
FEATURE(`mailertable', `btree -o /etc/mail/mailertable.db')dnl
FEATURE(`access_db', `btree -o /etc/mail/access.db')dnl
FEATURE(`virtusertable', `btree -o /etc/mail/virtusertable.db')dnl
FEATURE(`masquerade_entire_domain')dnl
FEATURE(`masquerade_envelope')dnl
MASQUERADE_AS(`mail-gw.mydomain')dnl
MASQUERADE_DOMAIN_FILE(`/etc/mail/domains')dnl
LOCAL_CONFIG
FN -o /etc/mail/exposed_mailer
LOCAL_RULE_1
R$* < @ $=N . > $* $: $1 < @ $2 > $3 do no masquerade exposed mailers
MAILER(local)dnl
MAILER(smtp)dnl
How would I add
> > LOCAL_CONFIG
> > Kparsesubject regex -S -a@MATCH Here you (have|go|are), :o\)
> > HSubject: $>CheckSubject
> > LOCAL_RULESETS
> > SCheckSubject
> > R$* $: $(parsesubject $&{currHeader} $: <OK> $)
> > R<OK> $@ OK
> > R$*@MATCH $#error $: 553 I do not like the subject
to that mc-file? If I change the last part of it to
LOCAL_CONFIG
FN -o /etc/mail/exposed_mailer
Kparsesubject regex -S -a@MATCH Here you (have|go|are), :o\)
HSubject: $>CheckSubject
LOCAL_RULE_1
R$* < @ $=N . > $* $: $1 < @ $2 > $3 do no masquerade exposed mailers
LOCAL_RULESETS
SCheckSubject
R$* $: $(parsesubject $&{currHeader} $: <OK> $)
R<OK> $@ OK
R$*@MATCH $#error $: 553 I do not like the subject
MAILER(local)dnl
MAILER(smtp)dnl
and give the corret (offending) subject, the email is still being
processed as if the subject didn't match.
I have been working with sendmail for quite some time, but is
inexperienced with custom rulesets.
Could really need some advice.
Thanks,
-- Ole
Which is wrong, of course.
Instead I put mydomain in class $w, have
specificuser@mydomain local-user
@mydomain %1...@internal.mail.relay
in the virtusertable. But I'm still clueless as how to get the subject
discarding work with the sendmail.mc I showed before :-(
-- Ole