Setting automatic Default Signature

Revision as of 18:00, 2 October 2006 by Deugenin (talk | contribs)
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Use this script for set automatic Default Signatures for all users reading it's LDAP information.

I asume that user have any information in his LDAP attributes.

The script set_signature.sh:

  #!/bin/bash
  
  RUTA="/opt/zimbra/bin"
  
  # Check for run as zimbra user
  ID=`id -u -n`
  if [ x$ID != "xzimbra" ]; then
     echo "Please run as ZIMBRA user"
     echo "Exiting..."
     exit 1
  fi
  
  
  # Obtain all accounts
  accounts=`$RUTA/zmprov gaa`
  
  for ac in $accounts; do
     echo -ne "Checking account: $ac \t"
  
     # Verify for set signature
     sign=`$RUTA/zmprov -l ga $ac | grep zimbraPrefMailSignatureEnabled | cut -d : -f 2`
  
     if [ `echo $sign | grep TRUE` ]; then
        echo "This account have a Signature!!!"
     else
        echo -ne "Setting signature... "
  
        # Obtain signature from LDAP user atributes
        signature=`$RUTA/zmprov ga $ac | egrep "(^cn|^ou|^company|^street|^telephoneNumber)" | cut -d : -f 2 | sed 's/^\ //g'`
  
        # Set signature for account $ca
        $RUTA/zmprov ma $ac zimbraPrefMailSignatureEnabled TRUE  zimbraPrefMailSignatureStyle internet zimbraPrefMailSignature "$signature"
  
        echo "done!"
     fi
  
  done


For example: My LDAP user is:

  # name daniel@test.cl
  cn: Daniel A. Eugenin
  co: Chile
  company: IT Linux Ltda.
  displayName: Daniel A. Eugenin
  givenName: Daniel
  initials: A
  l: Santiago
  objectClass: organizationalPerson
  objectClass: zimbraAccount
  objectClass: amavisAccount
  ou: Informatica
  postalCode: 00000
  sn: Eugenin
  street: General Holley XXX of. XX - Providencia
  telephoneNumber: (+56-2) XXX XX XX
  uid: daniel
  ...


And the signature result:

  -- 
  Daniel A. Eugenín
  IT Linux Ltda.
  Informática
  General Holley XXX of. XX - Providencia
  (+56-2) XXX XX XX
Jump to: navigation, search