Page 1 of 1

Add signature using CLI

Posted: Tue Sep 27, 2016 11:41 am
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

Re: Add signature using CLI

Posted: Tue Sep 27, 2016 2:42 pm
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"

Re: Add signature using CLI

Posted: Thu Sep 07, 2017 12:41 am
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.

Re: Add signature using CLI

Posted: Thu Sep 14, 2017 1:14 pm
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">&lt;html>from me&lt;/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.