Difference between revisions of "Setting automatic Default Signature"

 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
{{Archive}}{{Unsupported}}
 +
 
Use this script for set automatic Default Signatures for all users reading it's LDAP information.
 
Use this script for set automatic Default Signatures for all users reading it's LDAP information.
  
Line 19: Line 21:
 
    
 
    
 
   # Obtain all accounts
 
   # Obtain all accounts
   accounts=`$RUTA/zmprov gaa`
+
   accounts=`$RUTA/zmprov -l gaa`
 
    
 
    
 
   for ac in $accounts; do
 
   for ac in $accounts; do
Line 28: Line 30:
 
    
 
    
 
       if [ `echo $sign | grep TRUE` ]; then
 
       if [ `echo $sign | grep TRUE` ]; then
         echo "This account have a Signature!!!"
+
         echo "This account have a Signature. Nothing to do."
 
       else
 
       else
 
         echo -ne "Setting signature... "
 
         echo -ne "Setting signature... "
Line 75: Line 77:
 
   General Holley XXX of. XX - Providencia
 
   General Holley XXX of. XX - Providencia
 
   (+56-2) XXX XX XX
 
   (+56-2) XXX XX XX
 +
 +
 +
{{Article Footer|unknown|10/2/2006}}
 +
 +
[[Category:Customizing ZCS]]
 +
[[Category:LDAP]]

Latest revision as of 20:27, 25 March 2015


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 -l 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. Nothing to do."
     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


Verified Against: unknown Date Created: 10/2/2006
Article ID: https://wiki.zimbra.com/index.php?title=Setting_automatic_Default_Signature Date Modified: 2015-03-25



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