RE: Possible for postfix to 'reprocess' a received email?

From: Terry Gilsenan (no email)
Date: Sat Oct 03 2009 - 20:56:36 EDT

  • Next message: Dave Täht: "Re: ipv6 and smart(er) relaying"

    >Hello
    >
    >I have a query and thought hopefully someone can answer. This is a postfix and dovecot related question so I thought this would be a good place to start.
    >
    >I have postfix + dovecot (maildir storage) setup working good. I have some recipient canonical mapping and some virtual based forwarding taking place. What I'd like to do is have postfix reprocess a specific email that is stored in the /etc/spool/mail directory tree under a IMAP folder structure, perhaps by >altering the file in some way and copying it to /etc/spool/postfix/maildrop or hold.
    >
    >By reprocess I mean acting upon a stored email as though it was entering the system for the first time, retaining the original from and to. I think this boils down to understanding the different in the formats of the stored email files in /etc/spool/mail and those that postfix itself uses in /etc/spool/postfix

    I would suggest using a script that implements formail and procmail....

    cat /etc/spool/mail/* | formail -s procmail -m $HOME/.procmailrc

    .procmailrc..:

    SHELL=/bin/bash
    VERBOSE=no
    PATH=/home/filter:/usr/local/bin:/usr/bin:/bin
    MAILDIR=/home/me/mail
    DEFAULT=/dev/null
    TEMP=/tmp
    TMP=/tmp
    LOGFILE=/home/me/maillog.`date +%y-%m-%d`
    TRASH=/dev/null
    LOG="
    "
    #for the mail checker (noticer)
    SENDMAIL = /usr/sbin/sendmail
    FORMAIL = /usr/bin/formail
    GREP = /bin/grep
    CACHE_SIZE = 8192
    CACHE_FILE = $LOGDIR/.msgid.cache

    :0Wh: msgid.lock
    | formail -D $CACHE_SIZE $CACHE_FILE
    :0a
    {
            nl
            nl = ${notice+"$NL"}
            notice = "$notice${nl}X-Note: Message-ID seen before recently."
    }

    #create rules as needed here.....:

    :0:
    * ^Subject:.*viagra*
    {
      :0c
      $TRASH
    }

    :0:
    * From.*$WIFE
    :0
    {
      :0c
      !
    }

    $DEFAULT

    >Any advice greatly appreciated.
    >Stevie


  • Next message: Dave Täht: "Re: ipv6 and smart(er) relaying"





    Hosted Email Solutions

    Invaluement Anti-Spam DNSBLs



    Powered By FreeBSD   Powered By FreeBSD