External eMail Warnings
Customizing Amavis To Add Warning Messages To External Emails
Note: This is a customization and not supported officially. Try this on your staging environment before implementing on production server. This will not survive any upgrade.
Requirement
How can we add banner in the mail header for all emails from external domains
Solution
We have to do customization of Amavis in order to achieve this.
Step 1
- Create external_disclaimer.conf file
su - zimbra vi /opt/zimbra/conf/external_disclaimer.conf
- Edit with the below contents
use strict; $altermime='/opt/zimbra/common/bin/altermime'; @altermime_args_disclaimer = qw(--verbose --pretext=/opt/zimbra/data/altermime/_OPTION_.txt --pretext-html=/opt/zimbra/data/altermime/_OPTION_.html --force-for-bad-html); $defang_maps_by_ccat{+CC_CATCHALL} = ['disclaimer']; $allow_disclaimers = 1; @local_domains_maps = (["."]); @disclaimer_options_bysender_maps = ({ '.' => 'external_domains', },); 1;
- Create external_domains.html and external_domains.txt files and edit with your desired message
vi /opt/zimbra/data/altermime/external_domains.txt CAUTION: This email originated from an external domain, click links or open attachments once you recognize the sender and know the content is safe.
vi /opt/zimbra/data/altermime/external_domains.html
"'Note:"' Refer to this link for HTML color codes htmlcolorcodes
Step 2
Next we have to configure amavis to execute external_disclaimer.conf file for each email
- Open file amavisd.conf.in
vi /opt/zimbra/conf/amavisd.conf.in
- Add the following line at the end of the file
include_config_files('/opt/zimbra/conf/disclaimer-external.conf');
- Save and restart Amavis
zmamavisdctl restart
Submitted by: Samrat Sarkar |