Unknown user again

Julian Field mailscanner at ecs.soton.ac.uk
Wed Oct 20 20:09:56 IST 2004


<x-flowed>
Okay, here goes.

In /etc/MailScanner/MailScanner.conf, put this
Outgoing Queue Dir = &OutgoingQueue

In /usr/lib/MailScanner/MailScanner/CustomConfig.pm, add this near the top
-----SNIP-----
my $DefaultQueue = '/var/spool/mqueue';
my $SlowQueue    = '/var/spool/mqueue.slow';

sub InitOutgoingQueue {
   # No initialisation needs doing here at all.
   MailScanner::Log::InfoLog("Initialising OutgoingQueue");
}

sub EndOutgoingQueue {
   # No shutdown code needed here at all.
   # This function could log total stats, close databases, etc.
   MailScanner::Log::InfoLog("Ending OutgoingQueue");
}

# This will return 1 for all messages except those generated by this
# computer.
sub OutgoingQueue {
   my($message) = @_;

   return $DefaultQueue unless $message; # Default if no message passed in

   # Put the crap in the slow queue
   return $SlowQueue
     if $message->{subject} =~ /^Returned mail: see transcript for details/i ||
        $message->{subject} =~ /^Delivery Status Notification \(Failure\)/i  ||
        $message->{subject} =~ /^Warning: could not send message for past/i;

   # Put everything else in the fast queue
   return $DefaultQueue;
}
-----SNIP-----

Then set up a cron job in /etc/cron.hourly to do this

-----SNIP-----
#!/bin/sh
logger -p mail.notice 'Cleaning out slow queue'
rm -f /var/spool/mqueue.slow/*
exit 0
-----SNIP-----

Then just stop and restart MailScanner.

At 19:40 20/10/2004, you wrote:
>That is exaclty what I want!
>
>Thanks.
>
>bill anderson
>
>
>----- Original Message -----
>From: "Julian Field" <mailscanner at ECS.SOTON.AC.UK>
>To: <MAILSCANNER at JISCMAIL.AC.UK>
>Sent: Wednesday, October 20, 2004 11:37 AM
>Subject: Re: Unknown user again
>
>
> > Okay, there's a different approach you could use for what you explain
>below.
> >
> > What you can do is write a tiny little Custom Function in MailScanner that
> > looks at the subject line of the message, and if it is along the lines of
> > "Returned mail: see transcript for details" or "Delivery Status
> > Notification \(Failure\)" then put the outgoing message in a queue you
> > never deliver. There are many ways of achieving the same effect in
> > MailScanner, this just happens to be very similar to one I wrote earlier
> > this week for my own site.
> >
> > What I wanted to do was to put all delivery failure messages in a queue
> > that is run a lot slower than the main outgoing queue.
> >
> > You could use the same thing, but with a cron job that just deletes all
>the
> > files in the extra queue every hour or so.
> >
> > If you want to see how to do that, reply to this and confirm that this
>will
> > solve your problem for now. I don't want to post (and write) a whole bunch
> > of code and setup for you if it's not what you want.
> >
> > At 19:21 20/10/2004, you wrote:
> > >Thank you for the responses so far.  I apologize for being  a little
>dense,
> > >so please bear with me.
> > >
> > >I think I have the LDAP part down.
> > >
> > >My other question is somewhat different of the LDAP question above.  I
>think
> > >I understand that doing the LDAP routing piece will fix my problem,
>however,
> > >it will take some time to get it going.  The short term fix I was looking
> > >for is the ability to have mailscanner or sendmail after it has tried to
> > >relay an email to another server where the user does not exist, to not
>try
> > >and reply back to the sender that the address does not exist.  Basically
>my
> > >servers are accepting all email for a domain, scanning it, then
>forwarding
> > >it on.  In 50% of the cases, the email is destined to a non-existant
>address
> > >and I get a 550 message, so I try to send it back to the sender.  For now
>I
> > >just want to drop all of those when I get the 550 back.  I still will
>accept
> > >and scan all email destined for that domain.  I know it is not perfect,
>but
> > >I will stop spamming others with my "unknown user" replies.
> > >
> > >Thanks for bearing with me.
> > >
> > >bill anderson
> > >
> > >----- Original Message -----
> > >From: "Julian Field" <mailscanner at ECS.SOTON.AC.UK>
> > >To: <MAILSCANNER at JISCMAIL.AC.UK>
> > >Sent: Wednesday, October 20, 2004 11:01 AM
> > >Subject: Re: Unknown user again
> > >
> > >
> > > > At 18:47 20/10/2004, you wrote:
> > > > >When you say local db file, are you refering to the accessdb file in
> > > > >sendmail?
> > > >
> > > > No, a separate one created for the job.
> > > >
> > > > >   So, if I can paraphrase what you just said.  Using some sort of
> > > > >script that get's a list of emails from the various email servers,
>some
> > > > >LDAP, some not.  Compile this list into an accessdb file for use by
> > > > >sendmail?
> > > >
> > > > Not into an accessdb, but into a db file that describes where to send
> > >email
> > > > for all of your users. It's basically all in the FAQ at
> > > > http://www.sng.ecs.soton.ac.uk/mailscanner/serve/cache/270.html
> > > > The setup described there is for getting a routing database out of an
> > > > Exchange server running Active Directory, but the sendmail setup is
> > >exactly
> > > > the same.
> > > >
> > > > >Is there anyway to have sendmail / mailscanner drop 550 errors it
> > >receives
> > > > >from the other mail servers?  I want to fix my short term problem.
> > > >
> > > > Yes, by doing this. If the rcpt address isn't in the ldap (but
>actually a
> > > > db file) routing table, the message gets rejected at SMTP time.
> > > >
> > > > >----- Original Message -----
> > > > >From: "Julian Field" <mailscanner at ECS.SOTON.AC.UK>
> > > > >To: <MAILSCANNER at JISCMAIL.AC.UK>
> > > > >Sent: Wednesday, October 20, 2004 10:27 AM
> > > > >Subject: Re: Unknown user again
> > > > >
> > > > >
> > > > > > There is a tweak on option (1). You can use the LDAP routing
>setup,
> > > > >without
> > > > > > *actually* using LDAP to build it. So you could have a script run
>from
> > > > >cron
> > > > > > that queried each of the servers somehow, and built a local db
>file of
> > >all
> > > > > > the valid addresses it should accept mail for. Then you use the
>LDAP
> > > > > > routing setup to use this local db file.
> > > > > >
> > > > > > At 18:18 20/10/2004, you wrote:
> > > > > > >1)  LDAP - many of the the servers don't support LDAP.  The
>ability
> > >to
> > > > >build
> > > > > > >a comprehnsive LDAP server is outside of our scope.
> > > > > > >
> > > > > > >1)  Is there anyway I can tell MailScanner and/or sendmail to not
> > >respond
> > > > >to
> > > > > > >a 550 unknown user error?  Bascially Mailscanner tries to deliver
>an
> > > > >email
> > > > > > >to an unknown user.  Once it gets the 550 error, it drops it.  I
>know
> > >the
> > > > > > >downside of what if it was an honest mistake, the sender would
>not be
> > > > > > >notified.  I would like to do this on a domain by domain basis.
> > > > > > >
> > > > > > >2) Can I talk to multiple LDAP databases depending on what domain
>the
> > > > > > >address is destined to.
> >
> > --
> > Julian Field
> > www.MailScanner.info
> > Professional Support Services at www.MailScanner.biz
> > MailScanner thanks transtec Computers for their support
> > Buy the MailScanner book at www.MailScanner.info/store
> >
> > PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654
> >
> > ------------------------ MailScanner list ------------------------
> > To unsubscribe, email jiscmail at jiscmail.ac.uk with the words:
> > 'leave mailscanner' in the body of the email.
> > Before posting, read the MAQ (http://www.mailscanner.biz/maq/) and
> > the archives (http://www.jiscmail.ac.uk/lists/mailscanner.html).
> >
>
>------------------------ MailScanner list ------------------------
>To unsubscribe, email jiscmail at jiscmail.ac.uk with the words:
>'leave mailscanner' in the body of the email.
>Before posting, read the MAQ (http://www.mailscanner.biz/maq/) and
>the archives (http://www.jiscmail.ac.uk/lists/mailscanner.html).

--
Julian Field
www.MailScanner.info
Professional Support Services at www.MailScanner.biz
MailScanner thanks transtec Computers for their support
Buy the MailScanner book at www.MailScanner.info/store

PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654

------------------------ MailScanner list ------------------------
To unsubscribe, email jiscmail at jiscmail.ac.uk with the words:
'leave mailscanner' in the body of the email.
Before posting, read the MAQ (http://www.mailscanner.biz/maq/) and
the archives (http://www.jiscmail.ac.uk/lists/mailscanner.html).
</x-flowed>



More information about the MailScanner mailing list