Introduction
You may find that you want to enable archiving for a domain via the command line. This is possible through the cpapi2 command below. I would suggest reviewing the document in the first link for the accepted Parameters and the second article to verify that this function is enabled on the server.
Steps to enable archiving via tweak settings
Procedure
The cpapi2 command here will need to be run via the command line. I would suggest running from the root user and invoking the --user flag for the user in question. The below example can set the archive for a user's incoming, outgoing, and mailman emails for 14 days. You will need to replace the <user> with the cPanel user that the domain belongs to and <domain.tld> with the domain in question.
cpapi2 --user=<user> Email set_archiving_configuration domains=<domain.tld> outgoing=14 incoming=14 mailman=14
In the example below, I'll use the following variables on my test server with the full output.
user = example
domain = example.dom
archive length = forever
Cent7 test: cpapi2 --user=example Email set_archiving_configuration domains=example.dom incoming=0 outgoing=0 mailman=0
---
cpanelresult:
apiversion: 2
data:
-
direction: outgoing
domain: example.dom
enabled: 1
retention_period: 0
status: 1
statusmsg: Updated archive configuration for “example.dom”.
-
direction: incoming
domain: example.dom
enabled: 1
retention_period: 0
status: 1
statusmsg: Updated archive configuration for “example.dom”.
-
direction: mailman
domain: example.dom
enabled: 1
retention_period: 0
status: 1
statusmsg: Updated archive configuration for “example.dom”.
event:
result: 1
func: set_archiving_configuration
module: Email
Comments
0 comments
Article is closed for comments.