On Thu, Oct 20, 2011 at 2:43 PM, Noel Jones <njo...@megan.vbhcs.org> wrote:
> On 10/20/2011 7:08 AM, Roland de Lepper wrote: > > Hi Noel, > > > > Sorry, but that is not working. > > > > The first filter (Disclaimer), caps the message to a tempfile. The > > last sendmail command put that file and sends the message back to > > the queuemanager. > > > > I tried all, but doesn't seem to work. That's why I did it that way, > > but that doesn't explain why mails send from mydomain do get the > > autoreply and email send from eg gmail, don't receive the autoreply. > > > > We have amavisd in front of the Postfix server. This is a "Cloud > > based" service. Maybe that's the bottleneck. > > Please stop top posting. > > > "doesn't seem to work" isn't a very useful problem description. > > You've been given the solution already. If you have trouble > implementing it, you should share exactly what you've done and the > result. > > For starters, please see > http://www.postfix.org/DEBUG_README.html#mail > In addition to the information requested above, we would need to see > the scripts you're using, or at least a link to where you obtained them. > > > -- Noel Jones > Sorry for toposting, but I had no clue what you've mean with that. Hopefully..now I do. I have a script for adding disclaimers to all outgoing email. (see disclaimer-script below) The line, "cat >in.$$ ||", caps the message in a tempfile. the last sendmail command takes the message and sends it to qmrg. My second script is an autoresponder script. the section which send the email back into postfix is: if [ -f "${RESPONSES_DIR}/${RECIPIENT}" ]; then rate_log_check #If SEND_RESPONSE still equals "1" after the rate_log_check function, send an autoresponse. if [ "${SEND_RESPONSE}" = "1" ] && [ "${RECIPIENT}" != "${SENDER}" ]; then (cat "${RESPONSES_DIR}/${RECIPIENT}") | sed -e "0,/^$/ { s/^To:.*/To: <${SENDER}>/ }" -e '0,/^$/ { /^Date:/ d }' | ${SENDMAIL} -i -f "${RECIPIENT}" "${SENDER}" I've remove the last sendmail command in the disclaimer script and add it after the ${SENDMAIL} in the autoresponderscript. Also the flags in master.cf are different for both filters. Disclaimer: flags=Rq responder: flags=Fq I hope its a bit clear now so someone can help me. Disclaimer-script: #!/bin/sh # Localize these. INSPECT_DIR=/var/spool/filter SENDMAIL=/usr/sbin/sendmail #NO_DISCLAIMER_DOMAINS=/etc/postfix/no_disclaimer_domains ADD_DISCLAIMER_DOMAINS=/etc/postfix/add_disclaimer_domains # Exit codes from <sysexits.h> EX_TEMPFAIL=75 EX_UNAVAILABLE=69 # Clean up when done or when aborting. trap "rm -f in.$$" 0 1 2 3 15 # Start processing. cd $INSPECT_DIR || { echo $INSPECT_DIR does not exist; exit $EX_TEMPFAIL; } cat >in.$$ || { echo Cannot save mail to file; exit $EX_TEMPFAIL; } # obtain To domains #to_domain=`grep -m1 "To:" in.$$ | cut -d "@" -f 2` from_domain=`grep -m1 "From:" in.$$ | cut -d "@" -f 2|sed "s/>//"` #if [ `grep -wi -v ^${to_domain}$ ${NO_DISCLAIMER_DOMAINS}` ]; then DISC_STRING="for the Brabanti" ATT_STRING=Content-Disposition FOOTER=`sed 'N;s/=\n//g; /$ATT_STRING/q' in.$$ |grep -m1 -o -E "($DISC_STRING|$ATT_STRING)"` if ! [ _"$FOOTER" == _"$DISC_STRING" ]; then if [ `grep -wi ^${from_domain}$ ${ADD_DISCLAIMER_DOMAINS}` ]; then #/usr/bin/altermime --input=in.$$ \ /usr/bin/altermime --log-syslog --verbose --multipart-insert --input=in.$$ \ --disclaimer=/etc/postfix/disclaimer.txt \ --disclaimer-html=/etc/postfix/disclaimer.html \ --xheader="X-Copyrighted-Material: Please visit http://www.brabantia.com" || \ { echo Message content rejected; exit $EX_UNAVAILABLE; } fi fi $SENDMAIL "$@" <in.$$ exit $?