can't get disclaimer to work

Discussion in 'HOWTO-Related Questions' started by ali888, Oct 25, 2011.

  1. ali888

    ali888 New Member

    Hi,

    I am having trouble getting postfix to append disclaimer on the outgoing emails. I can send emails out without any problem but there is no disclaimer in the outgoing emails.

    I followed exactly as instructed on this link -
    http://www.howtoforge.com/add-disclaimers-to-outgoing-emails-with-altermime-postfix-debian-etch

    Here is my master.cf

    #smtp inet n - - - - smtpd
    #smtp inet n - n - - smtpd
    125 inet n - n - - smtpd
    -o content_filter=dfilt:
    #submission inet n - - - - smtpd
    # -o smtpd_tls_security_level=encrypt
    # -o smtpd_sasl_auth_enable=yes
    # -o smtpd_client_restrictions=permit_sasl_authenticated,reject
    # -o milter_macro_daemon_name=ORIGINATING
    #smtps inet n - - - - smtpd
    # -o smtpd_tls_wrappermode=yes
    # -o smtpd_sasl_auth_enable=yes
    # -o smtpd_client_restrictions=permit_sasl_authenticated,reject
    # -o milter_macro_daemon_name=ORIGINATING
    #628 inet n - - - - qmqpd
    pickup fifo n - - 60 1 pickup
    cleanup unix n - - - 0 cleanup
    qmgr fifo n - n 300 1 qmgr
    #qmgr fifo n - - 300 1 oqmgr
    tlsmgr unix - - - 1000? 1 tlsmgr
    rewrite unix - - - - - trivial-rewrite
    bounce unix - - - - 0 bounce
    defer unix - - - - 0 bounce
    trace unix - - - - 0 bounce
    verify unix - - - - 1 verify
    flush unix n - - 1000? 0 flush
    proxymap unix - - n - - proxymap
    proxywrite unix - - n - 1 proxymap
    smtp unix - - - - - smtp
    # When relaying mail as backup MX, disable fallback_relay to avoid MX loops
    relay unix - - - - - smtp
    -o smtp_fallback_relay=
    # -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
    showq unix n - - - - showq
    error unix - - - - - error
    retry unix - - - - - error
    discard unix - - - - - discard
    local unix - n n - - local
    virtual unix - n n - - virtual
    lmtp unix - - - - - lmtp
    anvil unix - - - - 1 anvil
    scache unix - - - - 1 scache
    #
    # maildrop. See the Postfix MAILDROP_README file for details.
    # Also specify in main.cf: maildrop_destination_recipient_limit=1
    #
    maildrop unix - n n - - pipe
    flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
    #
    # ====================================================================
    #
    # Recent Cyrus versions can use the existing "lmtp" master.cf entry.
    #
    # Specify in cyrus.conf:
    # lmtp cmd="lmtpd -a" listen="localhost:lmtp" proto=tcp4
    #
    # Specify in main.cf one or more of the following:
    # mailbox_transport = lmtp:inet:localhost
    # virtual_transport = lmtp:inet:localhost
    #
    # ====================================================================
    #
    # Cyrus 2.1.5 (Amos Gouaux)
    # Also specify in main.cf: cyrus_destination_recipient_limit=1
    #
    #cyrus unix - n n - - pipe
    # user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
    #
    # ====================================================================
    # Old example of delivery via Cyrus.
    #
    #old-cyrus unix - n n - - pipe
    # flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
    #
    # ====================================================================
    #
    # See the Postfix UUCP_README file for configuration details.
    #
    uucp unix - n n - - pipe
    flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
    #
    # Other external delivery methods.
    #
    ifmail unix - n n - - pipe
    flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
    bsmtp unix - n n - - pipe
    flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
    scalemail-backend unix - n n - 2 pipe
    flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
    mailman unix - n n - - pipe
    flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
    ${nexthop} ${user}

    #
    # ====================================================================
    #
    # delivery through dovecot
    dovecot unix - n n - - pipe
    flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}

    dfilt unix - n n - - pipe
    flags=Rq user=filter argv=/etc/postfix/disclaimer -f ${sender} -- ${recipient}

    I wonder if it's to do with Dovecot.
    How do I troubleshoot this?

    Any help would be greatly appreciated.

    Thank you
     
  2. ali888

    ali888 New Member

    Hi,

    Just an update. I got a good news. It's now working.

    It's probably caused by the script because as soon as I changed the script to the original one that comes with the package. It works straight away.

    Thanks for your time.
     
  3. ali888

    ali888 New Member

    Hi,

    Oops, not quite there yet. But I think I have figured out what may seem to be the problem.

    If I use the script (the original one), it works right away but it will add the disclaimer to all incoming and outgoing emails - which is not what I wanted. Hence, I went back to look at the script modified by Falko and tried to see why it does not work for me. As soon as I put back the following If statement, it just stop adding the disclaimer.

    # obtain From address
    from_address=`grep -m 1 "From:" in.$$ | cut -d "<" -f 2 | cut -d ">" -f 1`

    if [ `grep -wi ^${from_address}$ ${DISCLAIMER_ADDRESSES}` ]; then
    /usr/bin/altermime --input=in.$$ \
    --disclaimer=/etc/postfix/disclaimer.txt \
    --disclaimer-html=/etc/postfix/disclaimer.txt \
    --xheader="X-Copyrighted-Material: Please visit http://www.company.com/privacy.htm" || \
    { echo Message content rejected; exit $EX_UNAVAILABLE; }
    fi

    Just wonder if anyone might be able to tell me how to debug the code so that it will work for me.

    By the way, in the DISCLAIMER_ADDRESSES, I have in the following format:
    [email protected]
    [email protected]

    Thank you
     
    Last edited: Oct 26, 2011
  4. falko

    falko Super Moderator Howtoforge Staff

    Do the FROM addresses match exactly the addresses in DISCLAIMER_ADDRESSES?
     
  5. ali888

    ali888 New Member

    Thanks for your reply.

    I am not sure because I am new to this linux script (.sh). However, I do not think it matches my DISCLAIMER_ADDRESSES. The reason being that is in your example of DISCLAIMER_ADDRESSES, you have something like [email protected] or [email protected]. My rough guess is the script might only work for your disclaimer addresses, not for mine ones because I have got the dot(.) between first name and last name.

    I got a feeling that this is to do with the FROM thing but wasn't just sure where to begin. Might have to start learning the script.

    Many thanks
     
  6. falko

    falko Super Moderator Howtoforge Staff

    Code:
    if [ `grep -wi ^${from_address}$ ${DISCLAIMER_ADDRESSES}` ]; then
    In this line the script checks if the from address is listed in the DISCLAIMER_ADDRESSES file. Therefore the from address must match one of the addresses from the DISCLAIMER_ADDRESSES exactly.

    That doesn't matter.
     
  7. ali888

    ali888 New Member

    Hi Falko,

    Thanks for your advice. I finally got it working. I can see the disclaimer appear on the outgoing emails when using Squirrelmail webmail.

    However, I noticed that when I send out emails via Outlook 2010, I do not see any disclaimer on the outgoing emails. I tested it by sending email to my Yahoo account via Outlook. I received the email but with no disclaimer.

    But if I sent from squirrelmail to my yahoo account, I got the email as well as the disclaimer at the end of the mail.

    I tried to google it for the answer, but from what I gathered, we need to put the disclaimer as part of the signature. I do not know if this is a good idea as there are about 20 machines I have to add the disclaimer as a signature. I wonder if there are any other way out that you may be able to suggest.

    Thank you very much
     
  8. falko

    falko Super Moderator Howtoforge Staff

    Does Outlook 2010 use the exact same sender address than SquirrelMail?

    Did you check your mail log?
     
  9. ali888

    ali888 New Member

    Hi Falko,

    No, the mail.log file does not indicate there is a problem. Everything appears to be fine in the log file.

    However, in the Outlook, I did try one thing though as part of my trial and error process and it got it to work. I did change "your name" from "mike ward" to "[email protected]". This does not make any sense to me but it did the trick.

    Thanks once again for the tips.
     

Share This Page