External eMail Warnings

Revision as of 05:12, 15 September 2021 by Sam4wiki (talk | contribs) (→‎Step 2)

Customizing Amavis To Add Warning Messages To External Emails

   KB 24353        Last updated on 2021-09-15  




0.00
(0 votes)


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
CAUTION: This email originated from an external domain, click links or open attachments once you recognize the sender and know the content is safe.

"'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, just above the line "1; # insure a defined return value"
include_config_files('/opt/zimbra/conf/disclaimer-external.conf');

1; # insure a defined return value
  • Save and restart Amavis
zmamavisdctl restart
Submitted by: Samrat Sarkar
Verified Against: ZCS 8.8.15 ZCS 9.0 Date Created:
Article ID: https://wiki.zimbra.com/index.php?title=External_eMail_Warnings Date Modified: 2021-09-15



Try Zimbra

Try Zimbra Collaboration with a 60-day free trial.
Get it now »

Want to get involved?

You can contribute in the Community, Wiki, Code, or development of Zimlets.
Find out more. »

Looking for a Video?

Visit our YouTube channel to get the latest webinars, technology news, product overviews, and so much more.
Go to the YouTube channel »


Jump to: navigation, search