Domain-wide disclaimers / Signatures, and From:

Discuss your pilot or production implementation with other Zimbra admins or our engineers.
Ace Suares
Advanced member
Advanced member
Posts: 55
Joined: Thu Aug 07, 2014 7:26 pm

Domain-wide disclaimers / Signatures, and From:

Postby Ace Suares » Tue Jul 26, 2016 3:22 am

When u are using domain-wide disclaimers, the disclaimers get chosen by the From: address.

We have a setup where we have various sub domains, but they all need to appear to be from the main domain.

So, mail from needs to come from

We do that via this code:

Code: Select all

$ cat SetFromAddress

for i in `zmprov -l gaa`
  uid=${i%@*} # extract the part before the @
  echo "aaa $i $ # add an alias for
  ma  $i zimbraPrefFromAddress $ #set the from: address to
  ma  $i zimbraPrefFromAddressType sendAs" | zmprov

This works well, except that Zimbra will choose the disclaimer for the domain '' for all addresses, instead of showing the disclaimer for!

Now I know this is a bad hack, my Perl is extremely lousy.

In /opt/zimbra/amavisd/sbin/amavisd, which is a Perl script, I made the following modifications:

Around line 15915:

Code: Select all

              $disclaimer_options = ''  if !defined $disclaimer_options;

              ### give some extra flavor 
              my $disclaimer_domain = $msginfo->sender_smtp;
              $disclaimer_domain =~ s/^<.*@([a-z.-A-Z]+)>$/$1/;
              if ($disclaimer_domain eq "") {
                $disclaimer_options = "";
              else {
                $disclaimer_options = "";
              ### ace 2016
              s/_OPTION_/$disclaimer_options/gs  for @altermime_args;

What this does, in a quite heinous manner, is looking at the SMTP return address, which seems to be coded as $msginfo->sender_smtp,
and the use a simple if statement to determine which disclaimer should be used.

For every new sub domain, the code has to be rewritten, and Zimbra updates may break this thing. I tried to pass the $disclaimer_domain but some 'tainted' security error popped up.

It would be marvelous if there was an option to specify per domain, what disclaimer should be chosen, but that may lay in the future somewhere.

For now, this seems to work, but I fear that the $msginfo->sender_smtp might not always give a correct value (forwarded messages? mailer daemon stuff?) but for now it holds.

Open for suggestions!

Return to “Administrators”

Who is online

Users browsing this forum: Baidu [Spider] and 17 guests