.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" 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 .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . 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 "IMAP 3pm" .TH IMAP 3pm 2024-03-18 "perl v5.38.2" "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 Cyrus::IMAP \- Interface to Cyrus imclient library .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& use Cyrus::IMAP; \& \& my $client = Cyrus::IMAP\->new(\*(Aqmailhost\*(Aq[, $flags]); \& $flags = Cyrus::IMAP::CONN_NONSYNCLITERAL; \& \& ($server, $mailbox) = Cyrus::IMAP\->fromURL($url); \& $url = Cyrus::IMAP\->toURL($server, $mailbox); \& \& $client\->setflags($flags); \& $client\->clearflags(Cyrus::IMAP::CONN_INITIALRESPONSE); \& $flags = $client\->flags; \& $server = $client\->servername; \& $client\->authenticate; \& $flags = Cyrus::IMAP::CALLBACK_NUMBERED || Cyrus::IMAP::CALLBACK_NOLITERAL; \& $client\->addcallback({\-trigger => $str, \-flags => $flags, \& \-callback => \e&cb, \-rock => \e$var}, ...); \& $client\->send(\e&callback, \e&cbdata, $format, ...); \& $client\->processoneevent; \& ($result, $text) = $client\->send(undef, undef, $format, ...); \& ($fd, $writepending) = $client\->getselectinfo; .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" The Cyrus::IMAP module provides an interface to the Cyrus \fBimclient\fR library. These are primarily useful for implementing \fBcyradm\fR operations within a Perl script; there are easier ways to implement general client operations, although they may be more limited in terms of authentication options when talking to a Cyrus imapd. .PP In the normal case, one will attach to a Cyrus server and authenticate using the best available method: .PP .Vb 5 \& my $client = Cyrus::IMAP::new(\*(Aqimap\*(Aq); \& $client\->authenticate; \& if (!$client\->send(\*(Aq\*(Aq, \*(Aq\*(Aq, \*(AqCREATE %s\*(Aq, \*(Aquser.\*(Aq . $username)) { \& warn "createmailbox user.$username: $@"; \& } .Ve .PP In simple mode as used above, \f(CWsend()\fR is invoked with \f(CW\*(C`undef\*(C'\fR, \f(CW0\fR, or \&\f(CW\*(Aq\*(Aq\fR for the callback and rock (callback data) arguments; it returns a list of \f(CW\*(C`($result, $text)\*(C'\fR from the command. If invoked in scalar context, it returns \f(CW$result\fR and places \f(CW$text\fR in \f(CW$@\fR. In this mode, there is no need to use \f(CWprocessoneevent()\fR. If more control is desired, use the callback and rock arguments and invoke \f(CWprocessoneevent()\fR regularly to receive results from the IMAP server. If still more control is needed, the \&\f(CWgetselectinfo()\fR method returns a list containing a file descriptor (\fInot\fR Perl filehandle) which can be passed to \fBselect()\fR; if the second element of the list is true, you should include it in the write mask as well as the read mask because the \fBimclient\fR library needs to perform queued output. .PP For more information, consult the Cyrus documentation. .SH NOTES .IX Header "NOTES" \&\f(CWsend()\fR behaves as if the \f(CW\*(C`Cyrus::IMAP::CONN_NONSYNCLITERAL\*(C'\fR flag is always set. This is because it is a wrapper for the C version, which cannot be made directly available from Perl, and synchronous literals require interaction with the IMAP server while parsing the format string. This is planned to be fixed in the future. .PP The \f(CW\*(AqLOGIN\*(Aq\fR mechanism can be used to authenticate with a plaintext username and password. This is intended as a workaround for a bug in early SASL implementations; use of Cyrus::IMAP with non-Cyrus servers is not recommended, primarily because there are easier ways to implement IMAP client functionality in Perl. (However, if you need SASL support, \f(CW\*(C`Cyrus::IMAP\*(C'\fR is currently the only way to get it.) .PP The file descriptor returned by \f(CWgetselectinfo()\fR should not be used for anything other than \f(CWselect()\fR. In particular, I/O on the file descriptor will almost certainly cause more problems than whatever problem you think you are trying to solve. .PP The \fBtoURL\fR and \fBfromURL\fR routines are to ease conversion between URLs and IMAP mailbox and server combinations, and are a simple frontend for the libcyrus functions of the same name. .PP The \fBimparse\fR library routines are not implemented, because they are little more than a (failed) attempt to make parsing as simple in C as it is in Perl. .PP This module exists primarily so we can integrate Cyrus administration into our Perl-based account management system, and secondarily so that we can rewrite \fBcyradm\fR in a sensible language instead of Tcl. Usability for other purposes is not guaranteed. .SH AUTHORs .IX Header "AUTHORs" Brandon S. Allbery , Rob Siemborski .SH "SEE ALSO" .IX Header "SEE ALSO" Cyrus::IMAP::Admin \&\fBperl\fR\|(1), \fBcyradm\fR\|(1), \fBimclient\fR\|(3), \fBimapd\fR\|(8).