.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Net::Sieve 3pm" .TH Net::Sieve 3pm "2022-06-30" "perl v5.34.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Net::Sieve \- Implementation of managesieve protocol to manage sieve scripts .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Net::Sieve; \& \& my $SieveServer = Net::Sieve\->new ( \& server => \*(Aqimap.server.org\*(Aq, \& user => \*(Aquser\*(Aq, \& password => \*(Aqpass\*(Aq , \& ); \& \& foreach my $script ( $SieveServer\->list() ) { \& print $script\->{name}." ".$script\->{status}."\en"; \& }; \& \& my $name_script = \*(Aqtest\*(Aq; \& \& # read \& print $SieveServer\->get($name_script); \& \& # write \& my $test_script=\*(Aq \& require "fileinto"; \& ## Place all these in the "Test" folder \& if header :contains "Subject" "[Test]" { \& fileinto "Test"; \& } \& \*(Aq; \& \& # other \& $SieveServer\->put($name_script,$new_script); \& $SieveServer\->activate($name_script); \& $SieveServer\->deactivate(); \& $SieveServer\->delete($name_script); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\fBNet::Sieve\fR is a package for clients for the \*(L"\s-1MANAGESIEVE\*(R"\s0 protocol, which is an Internet Draft protocol for manipulation of \*(L"Sieve\*(R" scripts in a repository. More simply, Net::Sieve lets you control your mail-filtering rule files on a mail server. .PP \&\fBNet::Sieve\fR supports the use of \*(L"\s-1TLS\*(R"\s0 via the \*(L"\s-1STARTTLS\*(R"\s0 command. \fBNet::Sieve\fR open the connexion to the sieve server, methods allow to list all scripts, activate or deactivate scripts, read, delete or put scripts. .PP Most of code come from the great Phil Pennock \fBsieve-connect\fR command-line tool . .PP See Net::Sieve::Script to manipulate Sieve scripts content. .SH "CONSTRUCTOR" .IX Header "CONSTRUCTOR" .SS "new" .IX Subsection "new" .Vb 10 \& Usage : \& my $SieveServer = Net::Sieve\->new ( \& server => \*(Aqimap.server.org\*(Aq, \& user => \*(Aquser\*(Aq, \& password => \*(Aqpass\*(Aq ); \& Returns : \& Net::Sieve object which contain current open socket \& Argument : \& server : default localhost \& port : default 2000 \& user : default logname or $ENV{USERNAME} or $ENV{LOGNAME} \& password : \& net_domain : \& sslkeyfile : default search in /etc/ssl/certs \& sslcertfile : default search in /etc/ssl/certs \& autmech : to force a particular authentication mechanism \& authzid : request authorisation to act as the specified id \& realm : pass realm information to the authentication mechanism \& ssl_verif : default 0x01, set 0x00 to don\*(Aqt verify and allow self\-signed cerificate \& notssl_verif: default 0x00, set 0x01 to don\*(Aqt verify and allow self\-signed cerificate \& debug : default 0, set 1 to have transmission logs \& dumptlsinfo : dump tls information .Ve .SH "METHODS" .IX Header "METHODS" .SS "sock" .IX Subsection "sock" .Vb 4 \& Usage : my $sock = $ServerSieve\->sock(); \& Return : open socket \& Argument : nothing \& Purpose : access to socket .Ve .SS "capabilities" .IX Subsection "capabilities" .Vb 4 \& Usage : my $script_capa = $ServerSieve\->capabilities(); \& Return : string with white space separator \& Argument : nothing \& Purpose : retrieve sieve script capabilities .Ve .SS "list" .IX Subsection "list" .Vb 7 \& Usage : \& foreach my $script ( $ServerSieve\->list() ) { \& print $script\->{name}." ".$script\->{status}."\en"; \& }; \& Return : array of hash with names and status scripts for current user \& Argument : nothing \& Purpose : list available scripts on server .Ve .SS "put" .IX Subsection "put" .Vb 4 \& Usage : $ServerSieve\->put($name,$script); \& Return : 1 on success, 0 on missing name or script \& Argument : name, script \& Purpose : put script on server .Ve .SS "get" .IX Subsection "get" .Vb 4 \& Usage : my $script = $ServerSieve\->get($name); \& Return : 0 on missing name, string with script on success \& Argument : name \& Purpose : put script on server .Ve .SS "activate" .IX Subsection "activate" .Vb 4 \& Usage : $ServerSieve\->activate($name); \& Return : 0 on pb, 1 on success \& Argument : name \& Purpose : set named script active and switch other scripts to unactive .Ve .SS "deactivate" .IX Subsection "deactivate" .Vb 4 \& Usage : $ServerSieve\->deactivate(); \& Return : activate response \& Argument : nothing \& Purpose : stop sieve processing, deactivate all scripts .Ve .SS "delete" .IX Subsection "delete" .Vb 4 \& Usage : $ServerSieve\->delete($name); \& Return : 0 on missing name, 1 on success \& Argument : name \& Purpose : delete script on server .Ve .SH "Minor public methods" .IX Header "Minor public methods" .SS "ssend" .IX Subsection "ssend" .Vb 1 \& Usage : $self\->ssend("GETSCRIPT \e"$name\e""); .Ve .SS "sget" .IX Subsection "sget" .Vb 6 \& Usage: \& $self\->sget(); \& unless (/^OK((?:\es.*)?)$/) { \& warn "SETACTIVE($name) failed: $_\en"; \& return 0; \& } .Ve .SS "sfinish" .IX Subsection "sfinish" send \s-1LOGOUT\s0 .SS "closedie" .IX Subsection "closedie" send \s-1LOGOUT\s0 and die .SS "closedie_NOmsg" .IX Subsection "closedie_NOmsg" closedie whitout message .SS "die_NOmsg" .IX Subsection "die_NOmsg" die .SH "BUGS" .IX Header "BUGS" I don't try plain text or client certificate authentication. .PP You can debug \s-1TLS\s0 connexion with openssl : .PP .Vb 1 \& openssl s_client \-connect your.server.org:2000 \-tls1 \-CApath /etc/apache/ssl.crt/somecrt.crt \-starttls imap .Ve .PP See response in \f(CW\*(C`Verify return code:\*(C'\fR .PP Or with gnutls-cli .PP .Vb 1 \& gnutls\-cli \-s \-p 4190 \-\-crlf \-\-insecure your.server.org .Ve .PP Use Ctrl+D after \s-1STARTTLS\s0 to begin \s-1TLS\s0 negotiation .SH "SUPPORT" .IX Header "SUPPORT" Please report any bugs or feature requests to \*(L"bug-net-sieve at rt.cpan.org\*(R", or through the web interface at . I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. .SH "AUTHOR" .IX Header "AUTHOR" Yves Agostini .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright 2008\-2017 Yves Agostini \- .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .PP The full text of the license can be found in the \&\s-1LICENSE\s0 file included with this module. .PP \&\fBsieve-connect\fR source code is under a BSD-style license and re-licensed for Net::Sieve with permission of the author. .SH "SEE ALSO" .IX Header "SEE ALSO" Net::Sieve::Script