RE: [PEAR-DEV] Imap Backend Propsal
| From: | Richard York | Date: | Fri, 13 Feb 2004 01:05:12 +0000 |
| Subject: | RE: [PEAR-DEV] Imap Backend Propsal | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-25635@lists.php.net to get a copy of this message | ||
Richard,
Thanks for the direction, here is what I have come up with for the URI
abstraction. I was looking at the specifications and the docs for
imap_open, apparently sometimes the server requires the 'notls' portion of
the connection call when a secure connection is not required and sometimes
it doesn't.
I was looking at using imap|imaps to differientiate between tls and notls
but that left out a third possibility, 'ssl/novalidate-cert'. I think I'd
be more in favor of appending that portion of the call as an anchor on the
end of the string.
I noticed, obviously that TLS is the same thing as SSL.. is that portion of
the argument always going to be called SSL (in the call to imap_open) or is
it called 'tls' on newer systems? Just leads me to question whether that
portion should also be added to the anchor.
At this point the anchor can have values of the following:
notls|novalidate-cert
Since not every server requires notls to be appended.
$url =& new
Net_URL('imap://user:pass@mail.example.com:143/INBOX#notls');
$connect = '{'.$url->server;
if (!empty($url->port)) {
$connect .= ':'.$url->port;
}
switch($url->protocol) {
case 'pop3s': $connect .= '/pop3/ssl'; break;
case 'pop3': $connect .= '/pop3; break;
case 'imaps': $connect .= '/imap/ssl'; break;
case 'imap': $connect .= '/imap'; break;
case 'nntps': $connect .= '/nntp/ssl'; break;
case 'nntp': $connect .= '/nntp'; break;
}
if (!empty($url->anchor)) {
$connect .= '/'.$url->anchor;
}
$connect .= '}';
if (!empty($url->path)) {
$connect .= $url->path;
}
$this->mailbox = imap_open($connect, $url->user, $user->pass);
Thanks,
Richard York