RE: [PEAR-DEV] Imap Backend Propsal
| From: | Richard York | Date: | Thu, 12 Feb 2004 09:19:29 +0000 |
| Subject: | RE: [PEAR-DEV] Imap Backend Propsal | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-25606@lists.php.net to get a copy of this message | ||
>Use a URI style abstraction:
>
>imap://user:pass@mail.yourhost.com:110/pop3/notls#INBOX
>
>You could even use Net_URL if you really wanted to get all the relevant
>parts.
>
>Richard Heyes
I have given this a try as it is, but the URL doesn't work when passed to
imap_open, the server portion of the URL must be enclosed in curly braces
and the user and password arguments are passed separately. I also tried
several variations based on the specification articles that I read. I don't
think it would be too much work for the user to visit the imap_open docs
which shows all the possible variations for different servers. I could
pre-define each possible variation of connection methods and define
constants for the user to pass.
Like so...
connect (
$user,
$pass,
$mode = 0,
$server = 'localhost', //(if null default to localhost)
$port = 0, //(if null use default port for
protocol)
$folder = 'INBOX', //(if null default to INBOX)
$utf7 = false //(false by default (imap_utf7_encode))
)
$mode options...
MAIL_IMAP_IMAP
'{'.$server.':'.$port.'}'.$folder;
MAIL_IMAP_POP3
'{'.$server.':'.$port.'/pop3}'.$folder;
MAIL_IMAP_POP3_NOTLS
MAIL_IMAP_IMAP_SSL
'{'.$server.':'.$port.'/imap/ssl}'.$folder;
MAIL_IMAP_POP3_SSL_NO_VALIDATE
'{'.$server.':'.$port.'/pop3/ssl/novalidate-cert}';
MAIL_IMAP_NNTP
'{'.$server.':'.$port.'/nntp}comp.test';
MAIL_IMAP_SPECIFY
(define the entire connection in the $server arg)
...etc...
Using the above the program can be set-up to default to an IMAP server on
localhost running on port 143.
Do you think this would make it easier to specify this argument, or further
confuse things?
Best Regards,
Richard York