[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.
liverpoolfcfan
Outstanding Member
Outstanding Member
Posts: 964
Joined: Sat Sep 13, 2014 12:47 am

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

Postby liverpoolfcfan » Tue Dec 15, 2020 11:24 pm

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
Outstanding Member
Outstanding Member
Posts: 964
Joined: Sat Sep 13, 2014 12:47 am

Modify amavisd to not add disclaimer for one domain

Postby liverpoolfcfan » Fri Dec 18, 2020 4:01 pm

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");
              }

Return to “Developers”

Who is online

Users browsing this forum: No registered users and 4 guests