This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

AlterMIME and Postfix Issue
#1
AlterMIME and Postfix Issue
I'm trying to set up disclaimers for a few different domains, however since trying to setup alterMIME, no e-mails are being sent out.


In /etc/postfix/disclaimer:
Code:
#!/bin/sh
# Localize these.
INSPECT_DIR=/var/spool/filter
SENDMAIL=/usr/sbin/sendmail

# Define our company address lists
DISCLAIMER_ADDRESSES_COMPANY-A=/etc/postfix/disclaimer_addresses_company-a
DISCLAIMER_ADDRESSES_COMPANY-B=/etc/postfix/company-b
DISCLAIMER_ADDRESSES_AUTOMATED_COMPANY-B=/etc/postfix/disclaimer_addresses_automated_company-b

# 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 From address domain

from_address=`grep -m 1 "From:" in.$$ | cut -f 2 -d '@' | cut -d ">" -f 1`

# If the from address matches companya then apply the appropiate disclaimed
if [ `grep -wi ^${from_address}$ ${DISCLAIMER_ADDRESSES_COMPANY-A}` ]; then
   /usr/bin/altermime --input=in.$$ \
    --disclaimer-html=/etc/postfix/disclaimer_company-a.txt || \
    { echo Message content rejected; exit $EX_UNAVAILABLE; }

# If the from address matches companyb then apply the appropiate disclaimed
if [ `grep -wi ^${from_address}$ ${DISCLAIMER_ADDRESSES_COMPANY-B}` ]; then
    /usr/bin/altermime --input=in.$$ \
    --disclaimer-html=/etc/postfix/disclaimer_company-b.txt || \
    { echo Message content rejected; exit $EX_UNAVAILABLE; }

# If the from address matches companyc then apply the appropiate disclaimed
if [ `grep -wi ^${from_address}$ ${DISCLAIMER_ADDRESSES_AUTOMATED_COMPANY-B}` ]; then
    /usr/bin/altermime --input=in.$$ \
    --disclaimer-html=/etc/postfix/disclaimer_automated_company-b.txt || \
    { echo Message content rejected; exit $EX_UNAVAILABLE; }

fi

# Send the email on as per the Postfix stack
$SENDMAIL "$@" <in.$$

exit $?

In /var/log/maillog:
Code:
Jul  1 16:38:43 keith-vps postfix/qmgr[10043]: 10E146C40C59: from=<keith@company-b.tk>, size=1033, nrcpt=1 (queue active)
Jul  1 16:38:43 keith-vps postfix/qmgr[10043]: 1885C6C40C63: from=<keith@company-b.tk>, size=1033, nrcpt=1 (queue active)
Jul  1 16:38:43 keith-vps postfix/pipe[32760]: 1885C6C40C63: to=<keith@company-b.tk>, relay=dfilt, delay=94138, delays=94138/0.01/0/0.1, dsn=4.3.0, status=SOFTBOUNCE (Command died with status 2: "/etc/postfix/disclaimer". Command output: /etc/postfix/disclaimer: line 7: disclaimer_addresses_company-a=/etc/postfix/disclaimer_addresses_company-a: No such file or directory /etc/postfix/disclaimer: line 52: syntax error: unexpected end of file )
Jul  1 16:38:43 keith-vps postfix/pipe[32758]: 10E146C40C59: to=<keith@company-b.tk>, relay=dfilt, delay=92774, delays=92774/0.01/0/0.1, dsn=4.3.0, status=SOFTBOUNCE (Command died with status 2: "/etc/postfix/disclaimer". Command output: /etc/postfix/disclaimer: line 7: disclaimer_addresses_company-a=/etc/postfix/disclaimer_addresses_company-a: No such file or directory /etc/postfix/disclaimer: line 52: syntax error: unexpected end of file )
r directory

Appropriate file permissions are set, all files do exist and are spelled right.... anything I else that I should check/verify?
Reply
Thanks given by:


Possibly Related Threads…
Thread Author Replies Views Last Post
user: 'postfix' host: 'localhost' (Got an error reading communication packets) cezars 0 2 ,481 02-01-2022, 08:58 PM
Last Post: cezars
Postfix mail.log to database stikekar 2 7 ,282 03-02-2019, 01:22 AM
Last Post: TGates
Using ssl certificate for Postfix and Dovecot in multiple domains. davi-dns 9 33 ,757 12-03-2018, 05:13 PM
Last Post: fearworks

Forum Jump:


Users browsing this thread: 1 Guest(s)