try
chown postfix /opt/zimbra/postfix/sbin/sendmail
chmod u+s /opt/zimbra/postfix/sbin/sendmail
try
chown postfix /opt/zimbra/postfix/sbin/sendmail
chmod u+s /opt/zimbra/postfix/sbin/sendmail
Originally Posted by marcmac
Wahoo! Thank you very much marcmac!
I spoke too soon! Now the script is stuck in a loop, I tried using zmlmtpinject which seemed to work for local mail only, external mail was not delivered. I modified the script to stop the loop but the mail will not be delivered:
In the sample they created a entry in master.cf for the "external interface"Code:#!/bin/sh # System dependent settings ALTERMIME=/usr/local/bin/altermime ALTERMIME_DIR=/opt/zimbra/filter/scratch SENDMAIL=/opt/zimbra/postfix/sbin/sendmail # Exit codes of commands invoked by Postfix are expected # to follow the conventions defined in <sysexits.h>. TEMPFAIL=75 UNAVAILABLE=69 # Change in to alterMIME's working directory and # notify Postfix if 'cd' fails. cd $ALTERMIME_DIR || { echo $ALTERMIME_DIR does not exist; exit $TEMPFAIL; } # Clean up when done or when aborting. trap "rm -f in.$$" 0 1 2 3 15 # Write mail to a temporary file # Notify Postfix if this fails cat >in.$$ || { echo Cannot write to $ALTERMIME_DIR; exit $TEMPFAIL; } # Call alterMIME, hand over the message and # tell alterMIME what to do with it if [ `cat in.$$ | grep X-Copyrighted-Material: | wc -l` -eq 0 ] then $ALTERMIME --input=in.$$ \ --disclaimer=/opt/zimbra/filter/disclaimer.txt \ --disclaimer-html=/opt/zimbra/filter/disclaimer.html \ --xheader="X-Copyrighted-Material: Please visit http://www.duxarea.com/disclaimer.html" \ --htmltoo \ --force-for-bad-html \ || \ { echo Message content rejected; exit $UNAVAILABLE; } # Call sendmail to reinject the message into Postfix $SENDMAIL "$@" <in.$$ # Use sendmail's EXIT STATUS to tell Postfix # how things went. exit $? #mv in.$$ /opt/zimbra/postfix/spool/maildrop #echo "-r $4 -s $2" > log.$$ #/opt/zimbra/bin/zmlmtpinject -r "$4" -s "$2" in.$$ fi echo Message has been through already; exit $UNAVAILABLE;
but I used the 127.0.0.1:10025 entry cause I'm not sure how having the extra entry would effect zimbra
Mine:
Theirs:Code:127.0.0.1:10025 inet n - n - - smtpd -o content_filter=disclaimer: -o local_recipient_maps= -o virtual_mailbox_maps= -o virtual_alias_maps= -o relay_recipient_maps= -o smtpd_restriction_classes= -o smtpd_delay_reject=no -o smtpd_client_restrictions=permit_mynetworks,reject -o smtpd_helo_restrictions= -o smtpd_sender_restrictions= -o smtpd_recipient_restrictions=permit_mynetworks,reject -o mynetworks_style=host -o mynetworks=127.0.0.0/8 -o strict_rfc821_envelopes=yes -o smtpd_error_sleep_time=0 -o smtpd_soft_error_limit=1001 -o smtpd_hard_error_limit=1000 -o smtpd_client_connection_count_limit=0 -o smtpd_client_connection_rate_limit=0 -o receive_override_options=no_header_body_checks,no_unknown_recipient_
Here is the bounce message from Postfix:Code:244.233.222.211:smtp inet n - n - - smtpd -o content_filter=disclaimer:
Code:This is the Postfix program at host my.zimbradomain.com. I'm sorry to have to inform you that your message could not be delivered to one or more recipients. It's attached below. For further assistance, please send mail to <postmaster> If you do so, please include this problem report. You can delete your own text from the attached returned message. The Postfix program <anonymouse@gmail.com>: service unavailable. Command output: Message has been through already
here's the problem.
Message path looks like this in zimbra:
source -> postfix:25 -> amavis:10024 -> postfix:10025 -> zcs:7025 (lmtp).
Your script adds this:
source -> postfix:25 -> amavis:10024 -> postfix:10025 -> yourscriptipe -> postfix:25 -> and back to amavis, etc, etc.
So you'll need to have your script submit back to postfix on another port (10026 is next in the progression) and postfix (in master.cf) will have to have that port set up with no content filter, no alias expansion, etc, etc, to forward on to lmtp.
Thanks again.
Here's the whole shabang for anyone else interested (need I say it? "Try at your own risk"):
First Get altermime and install it on your Zimbra box
http://www.pldaniels.com/altermime/
The original putmail.py is located at (no need to download it)
http://putmail.sourceforge.net/home.html
Optionally Joe's Own Editor is at
http://sourceforge.net/projects/joe-editor/
You might be able to useI use joe to edit text files, you can use vi, nano, joe or whatever you like to edit yoursCode:yum install joe
SSH into your zimbra box As root and download this posts attachment
Change the email address to one of your own email addressesCode:ssh root@my.zimbrabox.com wget http://www.zimbra.com/forums/attachment.php?attachmentid=187&stc=1 tar -xzvf add_disclaimer_files.tgz cp /opt/zimbra/postfix/conf/master.cf /opt/zimbra/postfix/conf/master.cf.bak mv master.cf /opt/zimbra/postfix/conf/master.cf chown zimbra:zimbra /opt/zimbra/postfix/conf/master.cf mv putmail.py /usr/local/bin chmod +x /usr/local/bin/putmail.py mkdir /opt/zimbra/.putmail mv putmailrc /opt/zimbra/.putmail joe /opt/zimbra/.putmail/putmailrc
/opt/zimbra/.putmail/putmailrc
save and exitCode:[config] server = localhost email = admin@myzimbradomain.com port = 10026
as root
Find and Change copyright URL to one of your ownCode:cd .. chown zimbra:zimbra /opt/zimbra/.putmail -R mkdir /opt/zimbra/filter mkdir /opt/zimbra/filter/scratch mv add_disclaimer /opt/zimbra/filter chmod +x /opt/zimbra/filter/add_disclaimer joe /opt/zimbra/filter/add_disclaimer
/opt/zimbra/filter/add_disclaimer
Save text and exitCode:--xheader="X-Copyrighted-Material: Please visit http://www.yourdomain.com/disclaimer.html" \
Now create the global footer files
as rootCode:joe /opt/zimbra/filter/disclaimer.txt
/opt/zimbra/filter/disclaimer.txt
Save the text and exitCode:Whatever text you want to appear at the bottom of each email
as root/opt/zimbra/filter/disclaimer.htmlCode:joe /opt/zimbra/filter/disclaimer.html
Save the text and exitCode:Whatever <b>HTML</b> text you want to appear at the bottom of each email
as rootIf all went well you now have global footers on each emailCode:chown zimbra:zimbra /opt/zimbra/filter -R mv zmrestart /opt/zimbra/bin chmod +x /opt/zimbra/bin/zmrestart chown zimbra:zimbra /opt/zimbra/bin/zmrestart su - zimbra zmrestart
Do what you can to support this excellent product. ZCS is too cool!!!![]()
From my content filter, can I directly inject the message into LMTP, instead of submitting it back to postfix on the 10026 port?
Basically when I tried to use LMTPInject I ended up in a loopOriginally Posted by marcmac
Sorry ... this is late... but i tried the script and I am getting the disclaimer to appear from all incoming (from external) and from all outgoing messages.
Anyway to prevent the incoming message to append the disclaimer??
adrian
P/s: Otherwise, it is another great solution for disclaimers!
A quick and dirty way of doings this would be to add a check on the from line, eg...Originally Posted by achow
This could be adapted to do a lookup with zmprov GetAllDomains, or an LDAP lookup, but then it might fit more into the realms of a perl/php/python script.Code:#!/bin/sh # System dependent settings ALTERMIME=/usr/local/bin/altermime ALTERMIME_DIR=/opt/zimbra/amavisd-new-2.3.3/tmp/ SENDMAIL=/usr/local/bin/putmail.py export HOME=/opt/zimbra # Exit codes of commands invoked by Postfix are expected # to follow the conventions defined in <sysexits.h>. TEMPFAIL=75 UNAVAILABLE=69 # Change in to alterMIME's working directory and # notify Postfix if 'cd' fails. cd $ALTERMIME_DIR || { echo $ALTERMIME_DIR does not exist; exit $TEMPFAIL; } # Clean up when done or when aborting. trap "rm -f in.$$" 0 1 2 3 15 # Write mail to a temporary file # Notify Postfix if this fails cat >in.$$ || { echo Cannot write to $ALTERMIME_DIR; exit $TEMPFAIL; } # test the message for relevant headers cat in.$$ | grep -qE '^From: .*@example.com>?' || { $SENDMAIL "$@" <in.$$ && exit $?; } # Call alterMIME, hand over the message and # tell alterMIME what to do with it $ALTERMIME --input=in.$$ \ --disclaimer=/opt/zimbra/filter/disclaimer.txt \ --disclaimer-html=/opt/zimbra/filter/disclaimer.html \ --xheader="X-Copyrighted-Material: Please visit http://www.example.com" \ --htmltoo \ --force-for-bad-html \ || \ { echo Message content rejected; exit $UNAVAILABLE; } # Call sendmail to reinject the message into Postfix $SENDMAIL "$@" <in.$$ # Use sendmail's EXIT STATUS to tell Postfix # how things went. exit $?
Confirmed working with the change in the add_disclaimer file.
Thanks so much.
adrian
There are currently 1 users browsing this thread. (0 members and 1 guests)