Mail::Transport::IMAP4(3pm) | User Contributed Perl Documentation | Mail::Transport::IMAP4(3pm) |
Mail::Transport::IMAP4 - proxy to Mail::IMAPClient
Mail::Transport::IMAP4 is a Mail::Transport::Receive is a Mail::Transport is a Mail::Reporter
my $imap = Mail::Transport::IMAP4->new(...); my $message = $imap->receive($id); $imap->send($message); my Mail::Box::Manager $mgr = Mail::Box::Manager->new; $mgr->open( # Generic folder options folder => 'imaps://...', access => 'rw', extract => 'ALWAYS', # Mail::IMAPClient options start with [A-Z] IgnoreSizeErrors => 1, Ssl => 1, );
The IMAP4 protocol is quite complicated: it is feature rich and allows various asynchronous actions. The main document describing IMAP is rfc3501 (which obsoleted the original specification of protocol 4r1 in rfc2060 in March 2003).
This package, as part of MailBox, does not implement the actual protocol itself but uses Mail::IMAPClient to do the work. The task for this package is to hide as many differences between that module's interface and the common MailBox folder types. Multiple Mail::Box::IMAP4 folders can share one Mail::Transport::IMAP4 connection.
The Mail::IMAPClient module is the best IMAP4 implementation for Perl5, but is not maintained. There are many known problems with the module, and solving those is outside the scope of MailBox. See http://rt.cpan.org/Public/Dist/Display.html?Name=Mail-IMAPClient for all the reported bugs.
Extends "DESCRIPTION" in Mail::Transport::Receive.
Extends "METHODS" in Mail::Transport::Receive.
Extends "Constructors" in Mail::Transport::Receive.
When an "imap_client" is specified, then the options "hostname", "port", "username", and "password" are extracted from it.
All %options which start with a capital are passed as initiation to Mail::IMAPClient. See that manual about the huge pile of parameters. When talking to Microsoft Exchange, you probabaly need the "IgnoreSizeErros". Probably, you need "Ssl" or "StartTLS" as well. As feature, you may also pass a HASH to Ssl, where "Mail::IMAPClient" only accepts an ARRAY.
For backwards compatibility, "ssl" is an alternative for "Ssl", and "starttls" for "StartTLS".
-Option --Defined in --Default authenticate 'AUTO' domain <server_name> executable Mail::Transport undef hostname Mail::Transport 'localhost' imap_client Mail::IMAPClient interval Mail::Transport 30 log Mail::Reporter 'WARNINGS' password Mail::Transport undef port Mail::Transport 143 proxy Mail::Transport undef retry Mail::Transport <false> timeout Mail::Transport 120 trace Mail::Reporter 'WARNINGS' username Mail::Transport undef via Mail::Transport 'imap'
When a CLASS is given, an object of that type is created for you. The created object can be retrieved via imapClient(), and than configured as defined by Mail::IMAPClient.
Extends "Receiving mail" in Mail::Transport::Receive.
Extends "Server connection" in Mail::Transport::Receive.
The settings are used by login() to get server access. The initial value origins from new(authenticate), but may be changed later.
Available basic $types are "CRAM-MD5", "NTLM", and "PLAIN". With "AUTO", all available types will be tried. When the Authen::NTLM is not installed, the "NTLM" option will silently be skipped. Be warned that, because of "PLAIN", erroneous username/password combinations will be passed readible as last attempt!
The "NTLM" authentication requires Authen::NTLM to be installed. Other methods may be added later. Besides, you may also specify a CODE reference which implements some authentication.
An ARRAY as $type can be used to specify both mechanism as callback. When no array is used, callback of the pair is set to "undef". See "authenticate" in Mail::IMAPClient for the gory details.
example:
$transporter->authentication('CRAM-MD5', [MY_AUTH => \&c], 'PLAIN'); foreach my $pair ($transporter->authentication) { my ($mechanism, $challenge) = @$pair; ... }
The follow methods handle protocol internals, and should not be used by a normal user of this class.
All %options will be passed to the constructor (new) of $class.
The boolean return value indicates whether the folder is selectable. It will return undef if it does not exist.
The right folder should be selected before this method is called. When the connection was lost, "undef" is returned. Without any messages, and empty array is returned. The retrieval is done by Mail::IMAPClient method "fetch()", which is then parsed.
The $what parameter can be 'SET', 'CLEAR', or 'REPLACE'. With the latter, all standard imap flags which do not appear in the list will be ignored: their value may either by set or cleared. See getFlags()
Unknown flags in @flags are stripped from their backslash and lower-cased. For instance, '\SomeWeirdFlag' will become `someweirdflag => 1'. It will be set to '1' for "SET", and '0' in case of "CLEAR".
example: translating IMAP4 flags into MailBox flags
my @flags = ('\Seen', '\Flagged'); my $labels = Mail::Transport::IMAP4->flags2labels(SET => @flags);
A HASH is returned. Names which do not appear will also provide a value in the returned: the negative for the value is it was present.
If the contact to the server was still present or could be established, an Mail::IMAPClient object is returned. Else, "undef" is returned and no further actions should be tried on the object.
Returned is a list of $label=>$value pairs which could not be send to the IMAP server. These values may be cached in a different way.
Extends "Error handling" in Mail::Transport::Receive.
Extends "Cleanup" in Mail::Transport::Receive.
This module is part of Mail-Box-IMAP4 distribution version 3.007, built on June 13, 2019. Website: http://perl.overmeer.net/CPAN/
Copyrights 2001-2019 by [Mark Overmeer]. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://dev.perl.org/licenses/
2022-12-01 | perl v5.36.0 |