Adding Disclaimer Text to each outgoing email

  • dlenorman
  • 04/03/10
  • Offline
Posted: Wed, 2011-04-13 16:13

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..


Howdy, I don't have any

  • andreychek
  • 01/04/09
  • Offline
  • Wed, 2011-04-13 16:29

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/


no documentation for AlterMime

  • dlenorman
  • 04/03/10
  • Offline
  • Wed, 2011-04-13 23:24

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..


Would it be possible to add this a a feature request?

  • dlenorman
  • 04/03/10
  • Offline
  • Thu, 2011-05-26 16:34

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..


Has anyone used Mailscanner for this??

  • dlenorman
  • 04/03/10
  • Offline
  • Thu, 2011-05-26 16:34

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!


Well, it's a bit of a long

  • andreychek
  • 01/04/09
  • Offline
  • Thu, 2011-05-26 19:14

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


from which ever emailaccount

  • ronald
  • 12/20/07
  • Offline
  • Fri, 2011-05-27 00:04

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/


AlterMIME config on CentOS 5.5 (possibly 5.6 too?)

  • kashicommodore
  • 05/27/11
  • Offline
  • Fri, 2011-05-27 08:13

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:


AlterMIME config on CentOS 5.5 (possibly 5.6 too?) - Part 2

  • kashicommodore
  • 05/27/11
  • Offline
  • Fri, 2011-05-27 08:31

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=<code>grep -m 1 &quot;From:&quot; in.$$ | cut -d &quot;&lt;&quot; -f 2 | cut -d &quot;@&quot; -f 1</code>
# and this one checks the domain.
from_domain=<code>grep -m 1 &quot;From:&quot; in.$$ | cut -d &quot;&lt;&quot; -f 2 | cut -d &quot;&gt;&quot; -f 1 | cut -d &quot;@&quot; -f 2</code>
 
if [ <code>grep -wi ^${from_domain}$ ${DISCLAIMER_DOMAINS}</code> ]; then
        if [ <code>grep -wi ^${from_address}$ ${DISCLAIMER_ADDRESSES}</code> ]; 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?


thanks for all the input...

  • dlenorman
  • 04/03/10
  • Offline
  • Tue, 2011-07-05 12:19

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

thanks again to all who responded....