[SOLVED] Modify amavisd to not add disclaimer for one domain

Have a great idea for extending Zimbra? Share ideas, ask questions, contribute, and get feedback.
Post Reply
liverpoolfcfan
Elite member
Elite member
Posts: 1099
Joined: Sat Sep 13, 2014 12:47 am

[SOLVED] Modify amavisd to not add disclaimer for one domain

Post by liverpoolfcfan »

I need to redirect all emails for certain mailboxes to a new external mailserver so they can be handled there. As a result, I do not want zimbra to add a standard domain disclaimer when it is forwarding them.

I already have configured disclaimer for external only and that works as expected. What I now need to do is also treat this new domain as internal.

Does anyone know of a way to be able to tell amavisd that the new external domain "is_local" or how to add a check within amavisd directly for the specific domain if it is not possible to include the external domain as a local domain.

TIA
Last edited by liverpoolfcfan on Fri Dec 18, 2020 4:02 pm, edited 1 time in total.
liverpoolfcfan
Elite member
Elite member
Posts: 1099
Joined: Sat Sep 13, 2014 12:47 am

Modify amavisd to not add disclaimer for one domain

Post by liverpoolfcfan »

Answering my own question in case anyone else has a similar requirement in future - NOTE: This is not an upgrade-safe modification. It will get overwritten if amavisd gets updated by a zimbra patch

I added an extra check into the /opt/zimbra/common/sbin/amavisd code to look for the external domain before checking the outbound_disclaimers_only and recip_is_local

Replace this code

Code: Select all

              } elsif (c('outbound_disclaimers_only') && $r->recip_is_local) {
                $to_be_mangled = 0;
                do_log(5, "will not add disclaimer, recipient is local");
              }
adding the extra check beforehand to always skip the disclaimer for the specified external domain

Code: Select all

              } elsif (index($r->recip_addr, "\@my.external.domain") != -1) {
                # Added by ########### to not add Disclaimer on mail redirected to accounts on secondary external server
                $to_be_mangled = 0;
                do_log(5, "will not add disclaimer, recipient is on the secondary external server");
              } elsif (c('outbound_disclaimers_only') && $r->recip_is_local) {
                $to_be_mangled = 0;
                do_log(5, "will not add disclaimer, recipient is local");
              }
Post Reply