This is an old version of the document!
Benno-client ist ein Kommandozeilen-Client für das REST API von Benno MailArchiv. Dieses Perl-Script kann als Basis für eigene Implementierungen genutzt werden.
In addition, it also offers the possibility to identify larger quantities of emails based on search criteria and to export them from the system, for example.
Benno Client ruft stellt Suchanfragen per REST-API an Benno MailArchiv. Die Anfragen können mit Hilfe der Lucene Query-Syntax formuliert werden.
Eine Suche gibt die Anzahl der gefundenen E-Mails anhand der Benno E-Mail Ids zurück. Die Anzahl der Rückgabewerte wird durch den Parameter –limt 20 festgelegt. Falls er nicht angegeben wird, ist die Voreinstellung 20.
# benno-client -q 'From:m.hendriks@hansen-und-meyer.de' 2016:446E2DD35A73880A569992D2CAC77EE78ACDA94383EA42247869D81CA5AD850800 2016:3B582513165E3BCEEF113F44F200FA9A4534EB3BFAE37264867745CE4EB4424500 2016:3B582513165E3BCEEF113F44F200FA9A4534EB3BFAE37264867745CE4EB4424500 3 emails found (first: 1, last: 20, limit: 20)
Die letzte (Status-)Zeile wird auf STDERR ausgegeben und kann mit 2>/dev/null entfernt werden. Damit kann die Liste als Eingabe zum Herunterladen der E-Mails dienen.
# benno-client -i 2012:E51F8A601C08E09004C02833347EFC2D7AD92E757FE4CEC5B10AD869E0D5BB2800
In the example below, all emails from the user "m.hendriks@hansen-und-meyer.de" from the year 2017 are to be exported. If more than 10,000 emails have been archived for the user, the limit should be set accordingly higher.
#!/bin/bash # # benno-client -q '(Sender:m.hendriks@hansen-und-meyer.de OR Recipient:m.hendriks@hansen-und-meyer.de) AND Date:[201701010000 TO 201808271605]' | \ while read bennoId; do [ "$bennoId" = "No results found." ] && exit benno-client -i $bennoId > /tmp/${bennoId}.eml done
# benno-client -h Usage: /usr/sbin/benno-client [-h] [-V] -s <secret> [-H <hostname>] [-c <container>] [-P <port>] <-q|-i> -s <secret> shared secret -q ' lucene query string or file with filter (search header as "HEADER-) -i ' fetch mail with id -f ' lucene filter string or file with filter -b ' begin with email number in response list -l ' limit respones to num -c ' archive container -H <hostname> (localhost) -P <port> (8080) -j dump raw JSON response -M print results as list of mail ids -v verbose -D debug mode