Results 1 to 8 of 8

Thread: Creating a default signature for a persona via CLI?

Hybrid View

  1. #1
    Join Date
    Mar 2012
    Location
    Phoenix, AZ
    Posts
    17
    Rep Power
    3

    Default Creating a default signature for a persona via CLI?

    Hey guys,
    I have created a no-reply@domain.com user for a department which is trying to curb direct contact. I only created it as a user because I thought I may need to in order to set the signature (not sure this is true).

    I would like to do the following 3 things via CLI (I've figured out 1 and 2):
    1) Add the no-reply user as an alias to account
    Code:
    Zmprov ma user@domain.com +zimbraAllowFromAddress no-reply@domain.com
    2) Add the no-reply user as a persona to a user's account
    Code:
    Zmprov cid user@domain.com "No Reply" zimbraPrefFromAddress no-reply@domain.com zimbraPrefFromDisplay "No Reply" zimbraPrefIdentityName "No Reply"
    3) Create a signature for the persona and set it as the default for that persona???

    I know I can create a signature for an account with something like:
    Code:
    zmprov csig user@domain.com no-reply-sig zimbraPrefMailSignatureHTML "This is a signature."
    How would you create a signature and set it as the default signature for a specific persona via CLI? I'd like to be able to do this without having to login as the user I'm adding the persona to.

  2. #2
    Join Date
    Mar 2012
    Location
    Pietermaritzburg
    Posts
    23
    Rep Power
    3

    Default set default signature

    Code:
    /opt/zimbra/bin/zmprov getSignatures email@tld.com | grep -B 1 "SIGNATURE NAME" | grep "Id" | cut -f 2 -d" "
    /opt/zimbra/bin/zmprov ma email@tld.com zimbraPrefDefaultSignatureId "SIGNATURE ID from above"
    You could easily script that into a bash file if you had say 100 users to update

  3. #3
    Join Date
    Mar 2012
    Location
    Phoenix, AZ
    Posts
    17
    Rep Power
    3

    Default

    I really appreciate the post.

    I'm new in both the world's of Zimbra and Linux. What you posted was completely new to me and ended up teaching me a lot about grep (yeah, that's how new I am).

    What you posted works for determining the signature ID and then setting as the default signature for the primary account. I guess when you said you could put it in a bash script it would continually call on some variable representing some list of users?

    I think this means that I need to create this signature on any account destined to use it. I've been trying to find a list of the attirbutes for createSignature but haven't been successful. Have you dabbled in this? I won't be pulling from ldap (though I did admire your script in that arena!) so I really just need to create it and then add it to accounts.

    Thanks a lot for your help so far!!

  4. #4
    Join Date
    Mar 2012
    Location
    Pietermaritzburg
    Posts
    23
    Rep Power
    3

    Default

    I think this may be what you are looking for

    Code:
    zmprov help account
    
      addAccountAlias(aaa) {name@domain|id} {alias@domain}
    
      checkPasswordStrength(cps) {name@domain|id} {password}
    
      createAccount(ca) {name@domain} {password} [attr1 value1 [attr2 value2...]]
    
      createDataSource(cds) {name@domain} {ds-type} {ds-name} zimbraDataSourceEnabled {TRUE|FALSE} zimbraDataSourceFolderId {folder-id} [attr1 value1 [attr2 value2...]]
    
      createIdentity(cid) {name@domain} {identity-name} [attr1 value1 [attr2 value2...]]
    
      createSignature(csig) {name@domain} {signature-name} [attr1 value1 [attr2 value2...]]
    
      deleteAccount(da) {name@domain|id}
    
      deleteDataSource(dds) {name@domain|id} {ds-name|ds-id}
    
      deleteIdentity(did) {name@domain|id} {identity-name}
    
      deleteSignature(dsig) {name@domain|id} {signature-name}
    
      getAccount(ga) [-e] {name@domain|id} [attr1 [attr2...]]
    
      getDataSources(gds) {name@domain|id} [arg1 [arg2...]]
    
      getIdentities(gid) {name@domain|id} [arg1 [arg...]]
    
      getSignatures(gsig) {name@domain|id} [arg1 [arg...]]
    
      getAccountMembership(gam) {name@domain|id}
    
      getAllAccounts(gaa) [-v] [-e] [-s server] [{domain}]
    
      getAllAdminAccounts(gaaa) [-v] [-e] [attr1 [attr2...]]
    
      modifyAccount(ma) {name@domain|id} [attr1 value1 [attr2 value2...]]
    
      modifyDataSource(mds) {name@domain|id} {ds-name|ds-id} [attr1 value1 [attr2 value2...]]
    
      modifyIdentity(mid) {name@domain|id} {identity-name} [attr1 value1 [attr2 value2...]]
    
      modifySignature(msig) {name@domain|id} {signature-name|signature-id} [attr1 value1 [attr2 value2...]]
    
      removeAccountAlias(raa) {name@domain|id} {alias@domain}
    
      renameAccount(ra) {name@domain|id} {newName@domain}
    
      setAccountCos(sac) {name@domain|id} {cos-name|cos-id}
    
      setPassword(sp) {name@domain|id} {password}
    if you run
    Code:
    zmprov --help
    you'll get a full list of what zmprov is capable of. Just remember that you need to be logged in as the zimbra user. Hope the above helps

  5. #5
    Join Date
    Mar 2012
    Location
    Phoenix, AZ
    Posts
    17
    Rep Power
    3

    Default

    createSignature(csig) {name@domain} {signature-name} [attr1 value1 [attr2 value2...]]

    The attributes it makes reference to are may benefit me. If I do the command below, it will create a signature with no content. I couldn't locate what any of these attributes might be. This would be for a really basic plain-text signature though I would like to look at HTML based signatures at a later time.
    Code:
    zmprov csig email@tld.com "Name of signature"

  6. #6
    Join Date
    Mar 2012
    Location
    Pietermaritzburg
    Posts
    23
    Rep Power
    3

    Default

    A full list of all the zimbra attributes that can be set is here

    /opt/zimbra/conf/attrs/zimbra-attrs.xml

    I would just grep it for signature related items, but the correct HTML signature attribute is set as follows

    Code:
    zmprov csig email@tld.com "SIGNAME" zimbraPrefMailSignatureHTML "<b>Some bold text</b>"

  7. #7
    Join Date
    Mar 2012
    Location
    Phoenix, AZ
    Posts
    17
    Rep Power
    3

    Default

    I learned a lot from the posts in this thread but I still do not know how I might set the default signature for a persona from CLI.

  8. #8
    Join Date
    Mar 2012
    Location
    Pietermaritzburg
    Posts
    23
    Rep Power
    3

    Default

    Hey

    Code:
    /opt/zimbra/bin/zmprov getSignatures email@tld.com | grep -B 1 "SIGNATURE NAME" | grep "Id" | cut -f 2 -d" "
    /opt/zimbra/bin/zmprov ma email@tld.com zimbraPrefDefaultSignatureId "SIGNATURE ID from above"
    The second line above sets the default signature from the command line, but in order to do so you would need to run the first line to get the signature ID from the specific account.

    Guide
    1) Login to your mail server via ssh
    2) sudo su zimbra (This would depend on your server. I have provided the way you would do it in Ubuntu) If it were say Centos||Redhat||Suse it would be different. It all depends on whether the logged in user is in /etc/sudoers, but I digress
    3) cd
    4) /opt/zimbra/bin/zmprov getSignatures email@tld.com | grep -B 1 "SIGNATURE NAME" | grep "Id" | cut -f 2 -d" "
    5) /opt/zimbra/bin/zmprov ma email@tld.com zimbraPrefDefaultSignatureId "SIGNATURE ID from above"
    Last edited by noondaysun; 06-19-2012 at 12:11 AM. Reason: sould -> would (spelling errors)

Similar Threads

  1. Automatic Default Signature
    By akintemel in forum Administrators
    Replies: 3
    Last Post: 12-22-2010, 04:03 AM
  2. Replies: 45
    Last Post: 11-28-2007, 06:39 PM
  3. 4.0.4 to 4.5.6 upgrade failed in network edition
    By chenthil in forum Administrators
    Replies: 1
    Last Post: 08-27-2007, 10:36 AM
  4. [SOLVED] Simple backup question...
    By dameron in forum Administrators
    Replies: 3
    Last Post: 08-25-2007, 10:36 PM
  5. Perdition not restart !!!!
    By olibite in forum Administrators
    Replies: 2
    Last Post: 05-22-2007, 04:50 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •