mailscanner only sees the envelope TO - solved

Ken Anderson ka at PACIFIC.NET
Thu Jul 17 16:23:31 IST 2003


I have incoming sendmail splitting multiple recipient messages into
multiple messages, so MailScanner and SA only see 1 recip per message.

Here's what I did. If any sendmail gurus out there thing this is a bad
idea, please let me know what a mess I've made of things :-)

1) Start the incoming sendmail with a different config file.
Changes to /etc/rc.d/init.d/MailScanner (from rpm install on redhat)
make this change to the incoming sendmail command line:
------ snip -------

  $SENDMAIL -bd -OPrivacyOptions=noetrn \
                       -ODeliveryMode=queueonly \
                       -OQueueDirectory=$INQDIR \
                       -OPidFile=$INPID \
                       -C/etc/mail/sendmail_in.cf

-------- snip --------

2) Make changes to the new sendmail config:
cp /etc/mail/sendmail /etc/mail/sendmail_in.cf

In sendmail_in.cf, add the following:
The comment header "QUEUE GROUP DEFINITIONS" should be there already.
Just add the single line under it.

------- snip --------
############################
# QUEUE GROUP DEFINITIONS  #
############################

Qmqueue, P=/var/spool/mqueue.in, F=f, r=1, R=8, I=2m

------- snip --------


AND, just above the "Ruleset 3" comment header, add the following:
(not sure if both lines are required or not...)

--------- snip --------

# LOCAL_RULESETS
Squeuegroup
R$* @ $*                $# mqueue
R$*                     $# mqueue

############################################
###  Ruleset 3 -- Name Canonicalization  ###
############################################


--------- snip ----------


Restart sendmail, and things like this start showing up in the log when
messages with multiple recipients come in:

Jul 17 08:14:31 host sendmail[7183]: h6HFDop8007183: split: maxrcpts=1,
rcpts=3, count=2, ids=h6HFDop9007183; h6HFDopA007183

So now mailscanner only sees 1 recip per message and rulesets only apply
to the user they are supposed to apply to. Cool, huh?
Thanks for all the suggestions!

Ken A
Pacific.Net



Stephen Swaney wrote:
> Excellent thought. Certainly the MTA is the right place to accomplish
> this if it can do the job. More below.
>
> On Wed, 2003-07-16 at 17:50, Ken Anderson wrote:
>
>
>>Stephen Swaney wrote:
>>
>>
>>>On Wed, 2003-07-16 at 13:48, Matt Kettler wrote:
>>>
>>>
>>>
>>>>At 12:09 PM 7/16/2003 -0400, Stephen Swaney wrote:
>>>>
>>>>
>>>>>What about a MailScanner option that passes delivery of messages to
>>>>>multiple to a recipients to another program, i.e. procmail?
>>>>>
>>>>>Steve
>>>>
>>>>At that point, why use spam-scanning via MailScanner at all? Why not just
>>>>use procmail to call SA for everything?.
>>>>
>>>
>>>
>>>Absolutely right and silly of me not to think of it.
>>>
>>>
>>>
>>>>By passing a subset of the messages to procmail, you've lost any benefits
>>>>of using MS to call SA.
>>>
>>>
>>>Right again and that is the way I used to use SpamAssassin. Don't want
>>>to go there again!
>>>
>>>Am I right in thinking that a message to multiple recipients is not
>>>"split into separate messages" until until the local delivery agent is
>>>called? If so, might it be possible to write another delivery agent that
>>>is only called if the message has multiple recipients. This new delivery
>>>agent would simply deliver the individual (split) messages to the
>>>incoming MailScanner directory.
>>
>>This seems ideal. If sendmail could be made to put all messages in the
>>incoming MS queue if they have 1 recipient, and all messages with > 1
>>recipient in another queue. Then you could use perl/other mail tools to
>>split/clone the messages with >1 recip and then move them back to the MS
>>incoming queue.
>
>
>
>
>>Another option:
>>
>>Looking at sendmail/TUNING:
>>------ snip ---------
>>
>>Before 8.12 sendmail delivers an e-mail sequentially to all its
>>recipients. For mailing lists or large aliases the overall delivery
>>time can be substantial... Some mailing list software therefore "split"
>>up e-mails into smaller pieces with fewer recipients. Sendmail 8.12 can
>>do this itself, either across queue groups or within a queue
>>directory... The latter is controlled by the 'r=' field of a queue group
>>declaration.
>>... So for this queue each envelope will have at most 5 recipients.
>>You can apply this to the main queue:
>>QUEUE_GROUP(`mqueue', `P=/var/spool/mqueue, F=f, r=5, R=8, I=2m')dnl
>>
>
>
> Very good catch. It if nothing else it pointed me to the sendmail tuning
> file :)
>
>
>>-------- snip ---------
>>
>>Or QUEUE_GROUP(`mqueue', `P=/var/spool/mqueue, F=f, r=5, R=8, I=2m')dnl
>>for 1 recip per message.
>>
>
>
> I'm having a hard time finding the documentation for the F=f & I=2m
> flags. Also wouldn't this operate on only emails with more the 5
> recipients (r=5), splitting the message into multiple messages, each
> with 5 recipients? Since I believe "R=" the number of queue runners and
> we wouldn't want any want "real" delivery (just MailScanner) picking up
> the messages, might something like:
>
>
>         QUEUE_GROUP(`multimqueue', `P=/var/spool/mqueue.in, F=f, r=1, R=0')dnl
>
>
> Work? Would this split the messages and leave them where MailScanner
> would normally pick them up?
>
> Since you would want this behavior only of the instance of sendmail that
> that processing incoming mail, that instance of sendmail might best call
> a separate sendmail.cf file.
>
> Any comments or suggestions appreciated.
>
>
>
>>This could be used to split all messages with multiple recipients into
>>messages with 1 recipient, right? Mail could then be queued up properly
>>for MS with 1 recip per message max, so all per-user rules never
>>affected other users. Anyone tried this?
>>
>>Thanks,
>>
>>Ken A.
>>
>>
>>
>>>Steve
>>>Steve at Swaney.com
>>>
>
>



More information about the MailScanner mailing list