Re: Removing emails from an email file automatically.

2003-02-20 Thread Cliff Sarginson
On Thu, Feb 20, 2003 at 11:07:25PM -0600, Dan Nelson wrote:
> In the last episode (Feb 20), Dragoncrest said:
> > Hmm.  I'm trying to avoid using Procmail at all costs since we're
> > currently on a Sendmail/Qpopper configuration that I can work with. 
> > But it may turn out that the only way around this IS to go with that. 
> > Thing is, I'd like to stick with what we have and make it work with
> > that rather than totally ripping our our MTA and throwing in a whole
> > brand new one we know nothing about.
> 
> Procmail is not an mta; it's an email filter.  It's usually launched
> from the .forward file, but you can configure sendmail to use procmail
> as the default local mail delivery agent, or you can run it standalone
> (procmail < message.txt) if you don't want it to be part of the mail
> delivery process at all.
> 
Mmm. Two things here, one is no you should definitely not go around
messing inside mailboxes with hand-written scripts; it is not just a
simple case of getting at the message, removing it and all will be well.
You have to take on board all sorts of probems like file-locking, like
the testing of pathological cases, and the fact you are possibly going
to be content inspecting mail concerning other people.

I presume you are trying to de-spam the incoming mail. This cannot be
done without some not inconsiderable effort.

Some of it you can do with your MTA (yours is sendmail I take it), by
the use of RBL (blacklist lookups for known spammers). Some of it can be
done by an MDA (such as procmail), and some of it can be better served
by the use of a spam-marking program such as spamassassin. You may also
want virus checking in it by the use of Amavis or some-such. In fact you
may end up doing checks at all sorts of levels during the delivery
process.

And then you have to decide what to do with the "spam", since
false-positives are possible. Your MUA (whatever you use to read the
mail may also have to have filter rules).

All in all this is not a 5 minute job. The majority of spam in the world
comes mainly from an estimated number of sources to be less than 200,
the number of people trying to give solutions to this must be quadruple
that number at least !

As pointed out above, procmail is not an MTA , techinically it is an
MDA, a delivery agent. It can be set up on a per-user basis or
system-wide. It can itself filter the mail into another program like
spamassassin and so on.

There is a lot of work involved in this, I know I have been busy for
a long time on it...and I am not running a corporate server !

You will need to do some investigations..asking here, looking at
solutions people have implemented. But no solutions are going to 100%
solve the problem, you can reduce it greatly by using the methods I
mention above.

I know zilch about sendmail, but I know that the new version of Postfix,
which I have yet to try, does allow for tight integration of these
various things..maybe also with sendmail...I don't know.

For reference: I use Postfix as MTA, Amavis/Antivir as virus checker,
and procmail recipes to use spamassassin to do spam checks. Even with an
artificially low threshold for spam marking I am getting maybe 1 false
positive spam a day, when I bump the threshold up to something more
realistic I would expect that to further drop.

-- 
Regards
   Cliff Sarginson 
   The Netherlands

[ This mail has been checked as virus-free ]

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message



Re: Removing emails from an email file automatically.

2003-02-20 Thread Dan Nelson
In the last episode (Feb 20), Dragoncrest said:
> Hmm.  I'm trying to avoid using Procmail at all costs since we're
> currently on a Sendmail/Qpopper configuration that I can work with. 
> But it may turn out that the only way around this IS to go with that. 
> Thing is, I'd like to stick with what we have and make it work with
> that rather than totally ripping our our MTA and throwing in a whole
> brand new one we know nothing about.

Procmail is not an mta; it's an email filter.  It's usually launched
from the .forward file, but you can configure sendmail to use procmail
as the default local mail delivery agent, or you can run it standalone
(procmail < message.txt) if you don't want it to be part of the mail
delivery process at all.

-- 
Dan Nelson
[EMAIL PROTECTED]

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message


Re: Removing emails from an email file automatically.

2003-02-20 Thread Dragoncrest
Hmm.  I'm trying to avoid using Procmail at all costs since we're 
currently on a Sendmail/Qpopper configuration that I can work with.  But it 
may turn out that the only way around this IS to go with that.  Thing is, 
I'd like to stick with what we have and make it work with that rather than 
totally ripping our our MTA and throwing in a whole brand new one we know 
nothing about.

At 02:39 PM 2/20/03 +1100, jacob rhoden wrote:
Hi,

On Wed, 19 Feb 2003, Dragoncrest wrote:
>   Hi all.  Is there a simple way to remove a single email from a 
mail file
> using an automated script of some kind?  Like combining grep with some
> other stuff like that?  I'm looking for ideas to get rid of rogue
> emails.  The other couple haven't exactly been a stellar success yet.  Can
> I setup something that will search a mail file, find a given sender, and
> then just nuke the message without hurting the mail file?  Thanks everyone.

I am not sure if you want to work on an existing file, or future mail
files. If it is future mail files then you probably want to use a program
which can stop the mail getting in the file in the first place. If this is
the case look up 'procmail'. It allows you to read a mail and do an action
on it through your .forward file.

Regards,
Jacob

___
Jacob RhodenPhone: +61 3 9844 6102
ITS DivisionEmail: [EMAIL PROTECTED]
Melbourne University   Mobile: +61 403 788 386




To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message



Fw: Removing emails from an email file automatically.

2003-02-20 Thread Kenzo
message bounced back with an undelivered message?

- Original Message -
From: "Kenzo" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, February 20, 2003 8:18 AM
Subject: Re: Removing emails from an email file automatically.


> Better yet, use postfix.  You can easily configure the files to block
about
> 90% of all spam.
> http://www.postfix.org/
> Also use IMGATe. works great.
> http://imgate.meiway.com/
> The site refers to it, as a mailgate for imail, but it will work for any
> system.
> On top of that you can use Amavis or RAV to scan all E-mails for viruses.
>
> - Original Message -
> From: "Ken McGlothlen" <[EMAIL PROTECTED]>
> To: "Dragoncrest" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Wednesday, February 19, 2003 10:23 PM
> Subject: Re: Removing emails from an email file automatically.
>
>
> > Dragoncrest <[EMAIL PROTECTED]> writes:
> >
> > | Is there a simple way to remove a single email from a mail file using
an
> > | automated script of some kind?
> >
> > Well, it's better to remove them on their way in, with a tool like
> procmail.
> >
> > I do have a set of tools I wrote to help one person get out from under
his
> > rather substantial spamload.  I don't know if they'll help, but they
might
> give
> > you some ideas.  Note that these are not exhaustively written; they're
> just
> > very, very cheap hacks that could be improved on.  Needless to say,
> they're all
> > intended to be run as root (unless you're working on your own mailbox).
> >
> > The first is "fromn," which gives you a numbered "from":
> >
> > #!/bin/sh
> >
> > from -f $1 | cat -n
> >
> > For example (dates slightly elided)
> >
> > $ fromn /var/mail/mcglk
> >  1  From [EMAIL PROTECTED]  Feb 19
20:02:46
> 2003
> >  2  From [EMAIL PROTECTED]  Feb 19
20:05:46
> 2003
> >  3  From [EMAIL PROTECTED]  Feb 19 20:05:57 2003
> >  4  From [EMAIL PROTECTED]  Feb 19
20:06:08
> 2003
> >  5  From [EMAIL PROTECTED]  Feb 19
20:06:21
> 2003
> >  6  From [EMAIL PROTECTED]  Feb 19 20:06:31
2003
> >  7  From [EMAIL PROTECTED]  Feb 19
20:06:57
> 2003
> >  8  From [EMAIL PROTECTED]  Feb 19 20:08:42 2003
> > $ _
> >
> > The second tool I have is "headers"
> >
> > #!/bin/sh
> >
> > skip=`dc -e "$2 1 - p"`
> > formail +"$skip" -1 -s < $1 | formail -X ""
> >
> > This allows me to see the headers of any particular message without
> violating
> > the privacy of the body of the message.  For example:
> >
> > $ headers /var/mail/mcglk 2
> > From [EMAIL PROTECTED]  Wed Feb 19 20:05:57 2003
> > Return-Path: <[EMAIL PROTECTED]>
> > Delivered-To: [EMAIL PROTECTED]
> > Received: from shagrat.julianhaight.com
(shagrat.julianhaight.com
> >   [216.127.43.86])
> > by c3po.artlogix.com (Postfix) with SMTP id 1D8331AA07
> > for <[EMAIL PROTECTED]>; Wed, 19 Feb 2003
20:05:57 -0800
> (PST)
> > Received: (qmail 13946 invoked from network);
> >   20 Feb 2003 03:59:44 -
> > Received: from localhost (HELO spamcop.net) (127.0.0.1)
> >   by shagrat.julianhaight.com with SMTP; 20 Feb 2003
> 03:59:44 -
> > From: SpamCop AutoResponder <[EMAIL PROTECTED]>
> > To: [EMAIL PROTECTED]
> > Subject: SpamCop has accepted 1 email for processing
> > Date: Thu, 20 Feb 2003 03:59:44 GMT
> > Message-ID: <[EMAIL PROTECTED]>
> > In-Reply-To: <[EMAIL PROTECTED]>
> > References: <[EMAIL PROTECTED]>
> > $ _
> >
> > If I really need to delete a message at this point, I can use
> /usr/bin/mail to
> > delete the message by the message number.
> >
> > Still, much better to use procmail so you don't have to do any of this
> stuff in
> > the first place if at all possible.
> >
> > | Can I setup something that will search a mail file, find a given
sender,
> and
> > | then just nuke the message without hurting the mail file?
> >
> > In theory.  Take a look at the manpages for formail (if you have
procmail
> > installed), which can extract headers from specific messages.
> >
> >
> > To Unsubscribe: send mail to [EMAIL PROTECTED]
> > with "unsubscribe freebsd-questions" in the body of the message
> >
>
>

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message



Re: Removing emails from an email file automatically.

2003-02-19 Thread Ken McGlothlen
Dragoncrest <[EMAIL PROTECTED]> writes:

| Is there a simple way to remove a single email from a mail file using an
| automated script of some kind?

Well, it's better to remove them on their way in, with a tool like procmail.

I do have a set of tools I wrote to help one person get out from under his
rather substantial spamload.  I don't know if they'll help, but they might give
you some ideas.  Note that these are not exhaustively written; they're just
very, very cheap hacks that could be improved on.  Needless to say, they're all
intended to be run as root (unless you're working on your own mailbox).

The first is "fromn," which gives you a numbered "from":

#!/bin/sh

from -f $1 | cat -n

For example (dates slightly elided)

$ fromn /var/mail/mcglk
 1  From [EMAIL PROTECTED]  Feb 19 20:02:46 2003
 2  From [EMAIL PROTECTED]  Feb 19 20:05:46 2003
 3  From [EMAIL PROTECTED]  Feb 19 20:05:57 2003
 4  From [EMAIL PROTECTED]  Feb 19 20:06:08 2003
 5  From [EMAIL PROTECTED]  Feb 19 20:06:21 2003
 6  From [EMAIL PROTECTED]  Feb 19 20:06:31 2003
 7  From [EMAIL PROTECTED]  Feb 19 20:06:57 2003
 8  From [EMAIL PROTECTED]  Feb 19 20:08:42 2003
$ _

The second tool I have is "headers"

#!/bin/sh

skip=`dc -e "$2 1 - p"`
formail +"$skip" -1 -s < $1 | formail -X ""

This allows me to see the headers of any particular message without violating
the privacy of the body of the message.  For example:

$ headers /var/mail/mcglk 2
From [EMAIL PROTECTED]  Wed Feb 19 20:05:57 2003
Return-Path: <[EMAIL PROTECTED]>
Delivered-To: [EMAIL PROTECTED]
Received: from shagrat.julianhaight.com (shagrat.julianhaight.com
  [216.127.43.86])
by c3po.artlogix.com (Postfix) with SMTP id 1D8331AA07
for <[EMAIL PROTECTED]>; Wed, 19 Feb 2003 20:05:57 -0800 (PST)
Received: (qmail 13946 invoked from network);
  20 Feb 2003 03:59:44 -
Received: from localhost (HELO spamcop.net) (127.0.0.1)
  by shagrat.julianhaight.com with SMTP; 20 Feb 2003 03:59:44 -
From: SpamCop AutoResponder <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: SpamCop has accepted 1 email for processing
Date: Thu, 20 Feb 2003 03:59:44 GMT
Message-ID: <[EMAIL PROTECTED]>
In-Reply-To: <[EMAIL PROTECTED]>
References: <[EMAIL PROTECTED]>
$ _

If I really need to delete a message at this point, I can use /usr/bin/mail to
delete the message by the message number.

Still, much better to use procmail so you don't have to do any of this stuff in
the first place if at all possible.

| Can I setup something that will search a mail file, find a given sender, and
| then just nuke the message without hurting the mail file?

In theory.  Take a look at the manpages for formail (if you have procmail
installed), which can extract headers from specific messages.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message



Re: Removing emails from an email file automatically.

2003-02-19 Thread jacob rhoden
Hi,

On Wed, 19 Feb 2003, Dragoncrest wrote:
>   Hi all.  Is there a simple way to remove a single email from a mail file
> using an automated script of some kind?  Like combining grep with some
> other stuff like that?  I'm looking for ideas to get rid of rogue
> emails.  The other couple haven't exactly been a stellar success yet.  Can
> I setup something that will search a mail file, find a given sender, and
> then just nuke the message without hurting the mail file?  Thanks everyone.

I am not sure if you want to work on an existing file, or future mail
files. If it is future mail files then you probably want to use a program
which can stop the mail getting in the file in the first place. If this is
the case look up 'procmail'. It allows you to read a mail and do an action
on it through your .forward file.

Regards,
Jacob

___
Jacob RhodenPhone: +61 3 9844 6102
ITS DivisionEmail: [EMAIL PROTECTED]
Melbourne University   Mobile: +61 403 788 386



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message



Removing emails from an email file automatically.

2003-02-19 Thread Dragoncrest
	Hi all.  Is there a simple way to remove a single email from a mail file 
using an automated script of some kind?  Like combining grep with some 
other stuff like that?  I'm looking for ideas to get rid of rogue 
emails.  The other couple haven't exactly been a stellar success yet.  Can 
I setup something that will search a mail file, find a given sender, and 
then just nuke the message without hurting the mail file?  Thanks everyone.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message