Consider adding support for REFERRAL / RFC 2221
A suggestion was made that it would be nice if https://tools.ietf.org/html/rfc2221 was implemented in Mail::IMAPClient.
The workaround was:
< $self->{$location}{imap} = Mail::IMAPClient->new(Uid => 1, %$args) or die "Could not connect to $location: $@";
---
Show quoted text
> try {
> $self->{$location}{imap} = Mail::IMAPClient->new(Uid => 1, %$args) or die $@;
> } catch {
> my $error = $_;
> # this is extremely minimal support for RFC 2221 but all i need for zimbra
> my $user = quotemeta uri_escape $args->{User};
> if ($error =~ m{^\d+ NO \[REFERRAL imap://$user\@(?<server>[\w.-]+)/\] AUTHENTICATE failed}) {
> $args->{Server} = $+{server};
> $self->connect_imap($location);
> } else {
> die "Could not connect to $location: $@";
> }
> };