Add signature using CLI

Post feedback about our hosted demo or your local install. Tell us what you love and/or what you’d like to see added in the future.
Post Reply
madoch
Posts: 1
Joined: Mon Sep 26, 2016 9:17 pm

Add signature using CLI

Post by madoch »

Hello,
I would like to add signature for each accounts in my zimbra 8.7 using zmmailbox.
I added sign using this: zmmailbox -z -m account@domain.pl csig test "my sign"
This added sign name "test" with text "my sign". Format is traditional text. I need a html version. How to do it ? Please help,
and my second asking.
How to set sign "test" for new messages , answer and forward and set sign "Below included messages" using CLI (not WebUI) ?

Image


thank you for answer

Best regards,
Adam
User avatar
Gren Elliot
Advanced member
Advanced member
Posts: 183
Joined: Tue Jun 10, 2014 4:45 am

Re: Add signature using CLI

Post by Gren Elliot »

Just had a quick platy, and this appears to do the trick (creating an HTML signature and a text downgrade)

Code: Select all

zmsoap -z -type account -m user@example.com CreateSignatureRequest/signature @name="globalSignature" content="<html>from me</html>" @type="text/html"
User avatar
fs.schmidt
Outstanding Member
Outstanding Member
Posts: 278
Joined: Sat Sep 13, 2014 3:37 am
Location: Brazil
Contact:

Re: Add signature using CLI

Post by fs.schmidt »

Hi Eliot,

Thanks for sharing, it works for me!

Assuming that the user already has a signature and I want to the new one to be set as the default, would know the soap request to do so?

Best regards.
User avatar
Gren Elliot
Advanced member
Advanced member
Posts: 183
Joined: Tue Jun 10, 2014 4:45 am

Re: Add signature using CLI

Post by Gren Elliot »

You can find out the existing IDs of signatures using:

Code: Select all

zmsoap -z -type account -m gren@yak.fatkudu.co.uk GetSignaturesRequest
<GetSignaturesResponse xmlns="urn:zimbraAccount">
  <signature name="globalSignature" id="5e61ac1a-8e39-4eae-831b-7cfec07ed7e5">
    <content type="text/html"><html>from me</html></content>
  </signature>
</GetSignaturesResponse>
When you add a new signature, you are told the ID as well.

To find out the current default signature, use:

Code: Select all

zmsoap -z -type account -m gren@yak.fatkudu.co.uk GetPrefsRequest/pref @name=zimbraPrefDefaultSignatureId
<GetPrefsResponse xmlns="urn:zimbraAccount">
  <pref name="zimbraPrefDefaultSignatureId">5e61ac1a-8e39-4eae-831b-7cfec07ed7e5</pref>
</GetPrefsResponse>
To set it use:

Code: Select all

zmsoap -z -type account -m gren@yak.fatkudu.co.uk ModifyPrefsRequest/pref=5e61ac1a-8e39-4eae-831b-7cfec07ed7e5 @name=zimbraPrefDefaultSignatureId
<ModifyPrefsResponse xmlns="urn:zimbraAccount"/>
If you need to know the XML used in the SOAP requests (zmsoap syntax can be a bit unintuitive sometimes), use zmsoap's "-vv" option which increases verbosity.
Post Reply