Adding Disclaimer Text to each outgoing email

11 posts / 0 new
Last post
#1 Wed, 04/13/2011 - 17:13
dlenorman

Adding Disclaimer Text to each outgoing email

I need to add a digital signature or disclaimer text to outgoing emails from my domains.

Is there a setting within VirtualMin or WebMin where I can have each outgoing email on each unique domain add a "digital signature" or "disclaimer" text ?

If so, where may I find and use it?

If not, what do you recommend for this and is there away to integrate it into VirtualMin / WebMin?

Thanks! --David..

Wed, 04/13/2011 - 17:29
andreychek

Howdy,

I don't have any experience with automatically adding a footer into all outgoing messages... but, poking around on Google a bit, it looks like some folks have had success using the alterMIME program to do that:

http://www.pldaniels.com/altermime/

Thu, 04/14/2011 - 00:24 (Reply to #2)
dlenorman

Thanks for your suggestion. Unfortunately, the AlterMime PostFix HowTo is offline so this does not look viable for me.

Any other ideas out there? Something that can be integrated into Webmin / VirtualMin?

Thanks!

--David..

Thu, 05/26/2011 - 17:34 (Reply to #3)
dlenorman

Hi Eric,

Would it be possible to add the "disclaimer text" for outgoing emails as a feature request to future versions of VirtualMin...? Possibly integrate Altermime or similar into VirtualMin as a feature and then add a setup panel in the edit mail section of the VirtualMin area for each domain.

I think this would be a great addition and would be widely appreciated by the VIrtualMin community, especially those who use it in business settings.

Thank you sir...

--David..

Thu, 05/26/2011 - 17:34
dlenorman

I have read a little on Mailscanner... can this be used side by side with ClamAV without any interference?

Has anyone used Mailscanner for adding disclaimer texts to outgoing emails..?

Can ClamAV ad text to emails it has scanned..? or is the ClamAV scanner only for the local file system and not used in conjunction with the MTA (Postfix from a clean install on CentOS 5.6 and VirtualMin GPL)...?

Yes, I a little new to this...

thanks!

Thu, 05/26/2011 - 20:14
andreychek

Well, it's a bit of a long story, but I wouldn't expect to see a feature such as that in Virtualmin anytime soon :-)

I read a ClamAV thread from a few years back that suggests that it does not offer such a feature either (or at least, it didn't back then).

I did read that Amavis may offer such a feature, but I don't have any experience incorporating it into a server running Virtualmin.

-Eric

Fri, 05/27/2011 - 01:04
ronald
ronald's picture

from which ever emailaccount I need a signature, I do this through Usermin
or would this also not be viable?
There is also this:
http://sourceforge.net/projects/addattachfilter/files/

Fri, 05/27/2011 - 09:13
kashicommodore

Hey there. I've quite sucessfully implemented an AlterMIME install on CentOS. Lemme see if I can remember how I did it.

This brief guide presumes you have mail users setup all nice in Virtualmin, and that you are using Postfix Mailserver. Sorry, but I wouldn't know where to begin on another mailserver package.

Step 1: To actually get a working copy of AlterMIME without that compiling from source crap... add the RPMForge repositories to CentOS. AlterMIME is available from there....

To add the RPMForge repo's check: http://wiki.centos.org/AdditionalResources/Repositories/RPMForge Then its as simple as logging into a root SSH session and typing "yum install altermime".

Step 2: You'll need to add and edit a few files to make this work. We'll put all these files together with the postfix configurations. In my examples I have used nano, but you can use the editor of your choice. Lets start by making the disclaimers themselves.

cd /etc/postfix/
nano ./disclaimer_text.txt

(make yourself a text version of the disclaimer to be attached to mails) nano ./disclaimer_text.htm (and you can also make a HTML version with better formatting)

Step 3. Now we make a list of email addresses to have the disclaimer attached.... This file should have the email usernames that have a disclaimer attached. If you use username.domain style usernames, use those. Basically, the same username you'd use to login to IMAP/POP. For example....

nano ./disclaimer_addresses
---
kashicommodore
myotheruser
bobfromaccrosstheroad
---

Step 4. Now lets make a list of domains. The domains being separate from the usernames allows for us to support things like reply-to: and such when Virtualmin is using alias domains, and the same username can be used on different domains.

nano ./disclaimer_domains
---
mydomain.com
mydomain.net
sub.mydomain.com
---

Continued in next post:

Fri, 05/27/2011 - 09:31
kashicommodore

Step 5. Lets make the disclaimer filter script, that will be used by postfix to make altermime work it's magic.

nano ./disclaimer

Much of this script is a custom version of a script for Debian I found elsewhere, edited to make it work better in a Virtualmin/CentOS environment. Credit goes to the original author - though I cannot recall who it was.

#!/bin/sh
# Localize these.
INSPECT_DIR=/var/spool/filter
SENDMAIL=/usr/sbin/sendmail

####### Changed From Original Script #######
DISCLAIMER_ADDRESSES=/etc/postfix/disclaimer_addresses
DISCLAIMER_DOMAINS=/etc/postfix/disclaimer_domains
####### Changed From Original Script END #######

# 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; }

####### Changed From Original Script #######
# obtain From address
# this line checks the address in the from header
from_address=`grep -m 1 "From:" in.$$ | cut -d "<" -f 2 | cut -d "@" -f 1`
# and this one checks the domain.
from_domain=`grep -m 1 "From:" in.$$ | cut -d "<" -f 2 | cut -d ">" -f 1 | cut -d "@" -f 2`

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

$SENDMAIL -oi "$@" <in.$$

exit $?

Step 6. Lets tell postfix to apply the filter to outgoing mail, shall we? Open the postfix master config file

nano ./master.cf
</end code>
Find the line that looks like
<code>
smtp    inet    n       -       n       -       -       smtpd -o smtpd_sasl_auth_enable=yes

And change it to....

smtp    inet    n       -       n       -       -       smtpd -o smtpd_sasl_auth_enable=yes -o content_filter=dfilt:

Then add at the very base of the file.....

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

After a 'service postfix restart' you'll find that Postfix now applies your filter to all outgoing mail!

Feel free to edit the disclaimer script to your liking... altermime is quite configurable. It is quite possible to have the filter apply to all addresses on a domain.. or to filter more/less to your liking. Most of the hard work is in the two 'grep' lines.

There are a couple of additional notes here. If you use SMTPS (SMTP over SSL on port 465 you'll need to add the filter to the smtps line in master.cf too. Find the one like

smtps   inet    n       -       n       -       -       smtpd -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes -o smtpd_client_restrictionns=permit_sasl_authenticated,reject

and add this to the end of it...

-o content_filter=dfilt:

Also, your mileage may vary depending on how you've setup the username.domain kind of syntax. These steps may need a bit of adjustment here or there. But hey, its a start, right?

Tue, 07/05/2011 - 13:19 (Reply to #9)
dlenorman

I am working on implementing this on my server... will report back further with results.

thanks again to all who responded....

Wed, 10/21/2015 - 13:08
dbtallart

Regards to everyone.

I am trying to figure out how to add an outgoing email signature on a per user basis. I using postfix and dovecot. Could anyone help me with this scenario?.

Already grateful for your helps.

Topic locked