MailScanner Text File Creation

Stephen Conway sconway at WLNET.COM
Mon Oct 25 20:09:25 IST 2004


Hello:

Great, I have found actually that I can do all I need with really one
function, (that running off the non spam actions), here checking the sender
and our header criteria, and based on this either deleting and creating the
archive file, or delivering normally.  I do have one more question, by which
method / variable would I be able to write the entire message to a text file
including all headers?  I have found in Message.pm something like this:

$this->AppendToMbox($dir);

But, the AppendToMbox function is in Message.pm , I am getting the header
information from $message-{header} , is there a similar $message value that
will get the entire SMTP message?

Thanks for any assistance.

Steve

-----Original Message-----
From: MailScanner mailing list [mailto:MAILSCANNER at JISCMAIL.AC.UK] On Behalf
Of Julian Field
Sent: Monday, October 25, 2004 2:16 PM
To: MAILSCANNER at JISCMAIL.AC.UK
Subject: Re: MailScanner Text File Creation

Yes.

Custom Functions just need to return what would be the action of a ruleset.
Oh, with one exception, which I really must get around to fixing some time.
For yes/no results, you must return 1 or 0 (yes=1, no=0).

At 18:49 25/10/2004, you wrote:
>Hello:
>
>That is what I am doing now, is writing the two functions.  For the
>'archiving' all I need do , is return what would have been in the action of
>the ruleset, after matching my criteria?  I.e. , if it was archived to a
>location, or to another email address, just return these vaules back to MS
?
>
>Thanks for all assistance.
>
>Steve
>
>-----Original Message-----
>From: MailScanner mailing list [mailto:MAILSCANNER at JISCMAIL.AC.UK] On
Behalf
>Of Julian Field
>Sent: Monday, October 25, 2004 1:31 PM
>To: MAILSCANNER at JISCMAIL.AC.UK
>Subject: Re: MailScanner Text File Creation
>
>At 18:21 25/10/2004, you wrote:
> >Hello:
> >
> >I do know perl and am writing the functions, but I am looking now at the
> >Custom Function , the only problem I have, is that the Custom Function
must
> >be called from within the config file, and not from within a ruleset.  If
I
> >use custom functions, the one for the non SPAM actions is easy enough,
but
>I
> >will also need to do all archiving things / criteria from a custom
function
> >as well.  Or is it possible to do a custom action from within a ruleset?
>
>You can't call a custom function from a ruleset, just from a config option.
>
> >   If
> >not, this would be a great future additon to provide the option to run
> >custom actions from within a ruleset, in a similar fashion to the way you
> >have already from within the config file.
>
>It's not trivial to do. Why can't you just make the custom function make
>the same decisions as the ruleset would have made?
>
> >-----Original Message-----
> >From: MailScanner mailing list [mailto:MAILSCANNER at JISCMAIL.AC.UK] On
>Behalf
> >Of Julian Field
> >Sent: Monday, October 25, 2004 1:08 PM
> >To: MAILSCANNER at JISCMAIL.AC.UK
> >Subject: Re: MailScanner Text File Creation
> >
> >Yes, it can be done. It would need a Custom Function attached to the
> >Archive Mail option, and one attached to the non-spam actions option.
This
> >could ask if the particular header was defined, and produce a different
> >result in this case, compared to the normal response.
> >
> >But you will need some knowledge of perl to be able to write this.
> >
> >At 17:00 25/10/2004, you wrote:
> > >Hello Again:
> > >
> > >In this case, if somehow a Spammer managed to know what our custom
header
> > >was, and placed it into messages, these messages would be processed
> > >normally, (i.e. by the MS SPAM blocking routines, and / or SPAM
Assassin,
> > >anti-virus, etc).  It would, in this case only by-pass our archiving
rule
> > >and also our delete rule.
> > >
> > >In other words, since the message was already processed by MS, if I ran
>it
> > >through Sendmail again, would MS capture it and archive it the second
>time?
> > >
> > >All we are wondering , is if it can be done, and if so, how?
> > >
> > >Thanks for any assistance.
> > >
> > >Steve
> > >
> > >-----Original Message-----
> > >From: MailScanner mailing list [mailto:MAILSCANNER at JISCMAIL.AC.UK] On
> >Behalf
> > >Of Julian Field
> > >Sent: Monday, October 25, 2004 11:01 AM
> > >To: MAILSCANNER at JISCMAIL.AC.UK
> > >Subject: Re: MailScanner Text File Creation
> > >
> > >And what happens when a spammer starts sending you mail with that
header
>in
> > >it? You can't trust anything in the headers at all.
> > >
> > >On 25/10/04 3:48 pm, "Stephen Conway" <sconway at WLNET.COM> wrote:
> > > > Hello:
> > > >
> > > > I have managed the following, and have one further issue:
> > > >
> > > > I am now creating the archive, and also am 'deleting' the outgoing
> > >message,.
> > > > I have now a question about MailScanner rules, is there anyway that
MS
> >can
> > > > match on any other criteria, i.e. if a certain header exists in a
> >message,
> > > > then do something?  Example, after my processes analyze the archive
> > >created
> > > > above, I must then re-send the messages to the Internet to the
actual
> > > > recipients, but if I again put them through MS, they will again end
up
> >in
> > > > the archive, and a loop will be started.  I could send them via
>another
> > > > Sendmail process , or via another SMTP host but this involves
running
> > >other
> > > > processes, or server..
> > > >
> > > > After each process above, I put a header field into the messages
> > >'X-FLTMAIL'
> > > > .  What I would like to know is if MS finds this header, then it
>should
> > >not
> > > > archive the message , and also bypass the 'delete' rule .
> > > >
> > > > Any ideas on how this can be done?  In looking at ruleset syntax, it
>is
> > > > always 'from / To or Default' anyway to check for other fields /
> >criteria?
> > > > Maybe through a custom function?
> > > >
> > > > Thanks,
> > > >
> > > > Steve
> > > >
> > > > -----Original Message-----
> > > > From: MailScanner mailing list [mailto:MAILSCANNER at JISCMAIL.AC.UK]
On
> > >Behalf
> > > > Of Julian Field
> > > > Sent: Saturday, October 23, 2004 12:17 PM
> > > > To: MAILSCANNER at JISCMAIL.AC.UK
> > > > Subject: Re: MailScanner Text File Creation
> > > >
> > > > All you need to do to stop it delivering them is to use a 2-line
>ruleset
> > > > for Non spam actions, spam actions and high scoring spam actions.
> > > > From: domain.com delete
> > > > FromOrTo: default deliver
> > > >
> > > > Then use a ruleset for Archive Mail that says
> > > > From: domain.com yes
> > > > FromOrTo: default no
> > > >
> > > > At 16:31 23/10/2004, you wrote:
> > > >> Good day:
> > > >>
> > > >> The problem with using the archive method, is that the archive only
> > >stores
> > > > a
> > > >> copy there, but the messages are then delivered to their final
> > >recipients.
> > > >> What we need is for any mail from the domain to not be delivered ,
>but
> > > >> instead just copied to the location with the address file being
> > >generated.
> > > >> Which function in customconfig would I need to use?
> > > >>
> > > >> Thanks,
> > > >>
> > > >> Steve
> > > >>
> > > >> -----Original Message-----
> > > >> From: MailScanner mailing list [mailto:MAILSCANNER at JISCMAIL.AC.UK]
On
> > > > Behalf
> > > >> Of Julian Field
> > > >> Sent: Saturday, October 23, 2004 11:04 AM
> > > >> To: MAILSCANNER at JISCMAIL.AC.UK
> > > >> Subject: Re: MailScanner Text File Creation
> > > >>
> > > >> Take a look in CustomConfig.pm. There are several examples in
there,
> > > >> including a commented-out skeleton of what you need to do. Your
>Custom
> > > >> Function should return 'deliver' for all the messages except the
ones
> >you
> > > >> are interested in, and copy the files where you want them for the
> > > >> domain.com messages. You invoke it by putting
> > > >> Non spam actions = &YourCustomFunctionName
> > > >> in MailScanner.conf.
> > > >>
> > > >> The alternative approach I suggested (involving the mail archive)
may
> >be
> > > >> much easier for you to get working.
> > > >>
> > > >> At 15:49 23/10/2004, you wrote:
> > > >>> Hello Again:
> > > >>>
> > > >>> The custom function sounds like it would work, so I would first
set
> >my:
> > > >>>
> > > >>> Non spam actions = somefile.rules
> > > >>>
> > > >>> In somefile.rules I put the default, to be deliver , and for my
per
> > > > domain
> > > >>> would be:
> > > >>>
> > > >>> From: *@domain.com      ?
> > > >>> FromOrTo:       default deliver
> > > >>>
> > > >>> Please let me know what I would put here, and how to envoke a
custom
> > > >>> function, and if possible what this might look like,
> > > >>>
> > > >>> Thanks,
> > > >>>
> > > >>> Steve
> > > >>>
> > > >>> -----Original Message-----
> > > >>> From: MailScanner mailing list [mailto:MAILSCANNER at JISCMAIL.AC.UK]
>On
> > > >> Behalf
> > > >>> Of Julian Field
> > > >>> Sent: Friday, October 15, 2004 12:24 PM
> > > >>> To: MAILSCANNER at JISCMAIL.AC.UK
> > > >>> Subject: Re: MailScanner Text File Creation
> > > >>>
> > > >>> At 17:07 15/10/2004, you wrote:
> > > >>>> Good day:
> > > >>>>
> > > >>>> I had sent previously but missed the reply, if any.
> > > >>>>
> > > >>>> We have an application where we would need to have the following
to
> > > >> occur:
> > > >>>>
> > > >>>>> From *@domain.com ,
> > > >>>> Copy that entire SMTP message to /anypath/MESSAGEREF.inc
> > > >>>> Put a file to /anypath/MESSAGEREF.add which contains each
recipient
> >of
> > > >> the
> > > >>>> message on a separate line.
> > > >>>>
> > > >>>> Also, the message should stop there, i.e. not be sent out, as the
> > > >>> processing
> > > >>>> we have on those messages, will anylize then send those.
> > > >>>>
> > > >>>> Is there any way that MailScanner can be set up to do this?
> > > >>>
> > > >>> You would probably need to write a Custom Function to do this, and
> > > > probably
> > > >>> attach it to the "non-spam actions" configuration option. This
could
> > >test
> > > >>> for the *@domain.com and write out the message in the files you
>want.
> > > >>>
> > > >>> The alternative would be to archive mail using "Archive Mail" and
a
> > > >>> ruleset, then have a cron job that ran every 5 or 10 minutes and
> > > > processed
> > > >>> the archive entries to generate the processed data you want, then
> > >deleted
> > > >>> the original archive files so it didn't process the same mail
twice.

--
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).



More information about the MailScanner mailing list