Library to interface with Zimbra simply.
Author: Maxime Désécot maxime.desecot@gmail.com
OS: Linux distribution LTS
Language: Ruby2.7+
sudo apt install make gcc curl libcurl4-openssl-dev
gem install zm-ruby-client
admin = Zm::Client::Cluster.new(Zm::Client::ClusterConfig.new('config.json'))
admin.login
or
config = Zm::Client::ClusterConfig.new do |cc|
cc.zimbra_admin_host = 'mail.domain.tld'
cc.zimbra_admin_scheme = 'https'
cc.zimbra_admin_port = 443
cc.zimbra_admin_login = 'admin@domain.tld'
cc.zimbra_admin_password = 'secret'
end
admin = Zm::Client::Cluster.new(config)
admin.login
filter = '(&(mail=*@domain.tld)(zimbraLastLogonTimestamp<=20190225000000Z))'
accounts = admin.accounts.where(filter).all
account = admin.accounts.find_by name: 'maxime@domain.tld'
account = Zm::Client::Account.new(admin) do |acc|
acc.name = 'maxime@domain.tld'
end
account.zimbraMailQuota = 0
account.save