procmail
[Top] [All Lists]

RE: file saving

2001-12-03 10:15:38

Andreas asks:
Sent: Monday, December 03, 2001 12:11 AM

we are getting 2 files every 3 week to an existing
email address, and i dont know how to configure
procmail so i can save those to files automatically
to system disk. the file that are incoming are acsii
files.

There are many ways this can be done.  Some simple, some complex. Your
approach may depend upon whether you'll settle for just saving the
entire e-mail message as it came in (simple) or whether you want to
extract and save one/more file attachments in the message (more
complex).  You may settle for simply having a unique file name generated
for each message as it is delivered/saved (simple) or you may want to
construct the saved filename from information found in the message
itself (more complex).

Here's something simple, using procmail's delivery to directory facility
outlined in the "procmailrc" man page:

          Anything else will be taken as  a  mailbox  name  (either  a
          filename or a directory, absolute or relative to the current
          directory  (see  MAILDIR)).   If  it  is  a  (possibly   yet
          nonexistent) filename, the mail will be appended to it.

          If it is a directory, the mail will be delivered to a  newly
          created,  guaranteed  to be unique file named $MSGPREFIX* in
          the specified directory.  If  the  directory  name  ends  in
          "/.",  then  this  directory is presumed to be an MH folder;
          i.e. procmail will use the next number it  finds  available.
          When  procmail is delivering to directories, you can specify
          multiple directories to deliver  to  (procmail  will  do  so
          utilising hardlinks).


Using the directoy-level save capability, and letting procmail choose
the next message number, the recipe looks like this:

#
# Look for something in the mail header that tells us that it contains a
# message to be saved.  Here, we look for "bi-weekly data release" in
the
# subject, and that the mail is from "data-server(_at_)bluesky(_dot_)com".  
This is
just
# an example.  The choice of filter criteria is up to you.
#
# If the criteria matches, the mail message is saved under the directory
# named "bluesky_data". The file name used is derived as the next
available
# number, taken from the list of already existing files.
#
:0:
* ^Subject:.*bi-weekly data release
* ^From:(_dot_)*data-server(_at_)bluesky(_dot_)com
bluesky_data/.

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>