Need help with a script

Discussion in 'Programming/Scripts' started by Manuel, Oct 24, 2009.

  1. Manuel

    Manuel New Member


    I’ve been following the Virtual Users and Domains with Postfix, Courier and MySQL (Debian Etch) tutorial by Falko Timme and I’m very happy with the results. Our system performs very well but we have a problem related to
    a script we use.

    Mail considered as spam in our system is sent to a quarantine directory. Then a script processes all the mail in the quarantine and send those under a certain score to the users maildirs at /home/vmail/domain/maildirs for user’s examination. The problem is that the script we use strips the original separation or line feeds between header and body (and the rest of the lines too) and so the mail is counted as only header and has zero bytes. Consequently mail messages are not readable and you only get pieces of them by cliking for example in “View full header” in a mail client.

    Here are the lines:

    #Process by recipient
    # When there are a lot of recipients, the line X-Envelope-To: has one or several CRs.
    # To prevent this, we cut until the next tag X-…type X-Quarantain…etc appears.
    # We give the possibility of a maximum of 2048 additional lines in case of extensive list of To:
    Envelope_To=`grep -A 2048 -m 1 ^X-Envelope-To: $tmpfile | xargs echo 2>/dev/null | cut -f2 -d:|sed -e 's/X-.*//g'`
    deb "Mail recipients (X-Envelope-To): $Envelope_To"

    Where are we doing wrong? Come somebody tell?

    Thanks in advance
    Last edited: Oct 24, 2009

Share This Page