User Contributed Notes IMAP, POP3 and NNTP functions |
|
29-Mar-1999 02:37 |
|
The documentation on objects is sketchy for those of us (me) who don't do
OOP. I searched for info on how to access parts of an object (properties)
for a long time before finding the only e.g. in the manual, and it is not
obvious what to do to actually implement these in code. I realize it
isn't tough to figure out once you get started, but it is a black box
without that tiny little hint which is not well presented. I also don't
see anything about the bit masks for the flags nor anything about the
flags themselves.
|
|
06-Sep-1999 02:44 |
|
In order to get the IMAP functions to compile under apache (1.3.6) on
FreeBSD (3.2-R) and IMAP-4.6-BETA I had to unlink libc-client4.so from
libc-client4.so.5 and then link libc-client4.so to c-client.a. Hope this
is of use to anyone else in the future.
|
|
19-Sep-1999 12:19 |
|
The information at the top of this page IS A LIE.
If you want the IMAP functions then DO NOT
copy c-client.a into (for example) /usr/local/lib.
Instead, copy it to some appropriate directory in
your link path, but give it the new name:
libc-client4.a
It has GOT to have that name or else you will get
really weird *configure-time* failures when doing
the second configure step on Apache.
Also, if you are on a FreeBSD 3.1 system, look
around and see if you already had files installed
whose names are:
/usr/local/lib/libc-client4.so
/usr/local/lib/libc-client4.so.4
If you have these then DELETE THEM before you start the second configure
step on Apache or
else things will go very wrong. Don't ask me why.
I don't know. I just know that they don't work and
they must not be in your link path or else you won't even be able to do
the second Apache configure step.
|
|
21-Sep-1999 08:46 |
|
I've written <a href=">instructions
for installing IMAP support on Red Hat</a> (amongst other things)
that might help you get started.
|
|
14-Nov-1999 11:27 |
|
Some of the functions return Objects when in the docs it says Array.
echo the var to see it's type
to access an object member use ->
<PRE>
<?php
$mbox = imap_open("{localhost:143}INBOX", "username",
"password");
if ($hdr = imap_check($mbox)) {
echo "Num Messages " . $hdr->Nmsgs;
}
else {
echo "failed";
}
?>
</pre>
|
|
03-Dec-1999 08:18 |
|
I had all kinds of problems compiling and installing the latest version of
imap (4.7). So, i went and got imap-4.4.tar.Z to see if maybe it was a
version problem. 4.4 installed just fine. But you have to rename
c-client.a to libc-client4.a like [email protected] said above.
|
|
29-Dec-1999 07:22 |
|
I banged my head for hours getting configure-time errors when doing a
./configure in the apache directory after configuring PHP with IMAP
support. I had followed the instructions above. In the end, I had to
delete the file "/usr/lib/libimap.so" in order to get it to
compile okay. This was on Red Hat 6.1 with the 4.6-3 imap RPMs installed.
Just in case that helps somebody.
|
|
25-Jan-2000 07:27 |
|
To paraphrase Mark Musone:
The base you need to properly understand the php IMAP
functions is to know the c-client library, since the IMAP
module is just a port of the c-client library.
Start by looking at the internals.txt file in the doc directory of
c-client.
(Presumably this c-client/doc directory is in the IMAP directory, not the
PHP source itself... If I'm following Mark correctly.)
|
|
01-Feb-2000 06:21 |
|
When I call the imap_open() function it generates a warning:
Warning: Mailbox is empty in //opt/data/htdocs/ronnie/mail/InBox.php on
line 38
The funny thing here is that I must have that f_ck_ng stream in order to
check whether there are mails or not!!
If I send a couple of mails to that particular mailbox and run the script
again, it works properly.
What do I do?
Code:
$MailServer = "{mail.xxx:net/pop3:110}INBOX";
$Username = "myUserName";
$Password = "myPassword";
$mboxStream = imap_open( $MailServer, $Username, $Password);
It doesn't help checking whether the imap_open() returns false or
anything...I get a error anyway.
|
|
02-Feb-2000 12:25 |
|
...continuing the previous message...
Looks like I can't open (imap_open) a mailbox, containing Unread or/and
Recent messages. I can open it using OP_HALFOPEN, but it gives me
nothing... Does anyone else have this problem? Thanx!
|
|
02-Feb-2000 12:38 |
|
I found out that it's not a problem of imap_open!!! It's a problem with
imap_headers. I have overcame this problem using imap_header.
|
|
30-Mar-2000 06:58 |
|
How can I retrieve the messages flags?
I try all the IMAP functions such as imap_fetch_structure,
imap_fetch_overview, but i can't have the informations I need.
Maybe there is a BUG with these functions.
By the way why is the following functions undocumented?
imap_fetch_overview, imap_mail_compose, imap_popen.
|
|
03-Apr-2000 04:20 |
|
Note to RedHat users:
To get php imap support with redhat's shipped IMAP rpm, do the following.
1) Install both the imap and imap-devel rpm's
2) As mentioned above, copy /usr/lib/c-client.a to /usr/lib/libc-client.a
and the three headers (mail.h, linkage.h, and rfc822.h from
/usr/include/imap to /usr/include
3) Important! Before configuring PHP, you'll need to set a few
environmental variables. With bash, do:
export LDFLAGS="-L/usr/kerberos/lib -lkrb5 -lgssapi_krb5 -lpam"
or c shell:
setenv LDFLAGS "-L/usr/kerberos/lib -lkrb5 -lgssapi_krb5 -lpam"
Now configure php --with-imap and other options and all should work well.
|
|
28-Jul-2000 01:13 |
|
As stated above, "The underlying c-client library.... and local
mailbox access methods". How might one open a stream to a local mail
file such as /var/spool/mail/$USER ??
[email protected]: by using the filename as $mbox parameter
|
|
27-Feb-2001 11:28 |
|
I found that just adding the LDFlags to the PHP configure does not do the
job on a RedHat 7 System with User Compiled Apache /PHP but RPM imap.
what I did is following:
php config script :
export LDFLAGS="-L/usr/kerberos/lib -lkrb5 -lgssapi_krb5 -lpam"
./configure --with-mysql=/usr/local --with-apxs=/usr/local/apache/bin/apxs
--with-imap --includedir=/usr --with-openssl=/root/server/openssl-0.9.6
then the APACHE Config script:
export LDFLAGS="-L/usr/kerberos/lib -lkrb5 -lgssapi_krb5 -lpam"
./configure with the rest of the apache options
Now it Finaly works for me..
|
|
07-Apr-2001 11:36 |
|
Tried compiling PHP4 (latest @ 08:45 07 Apr 01) with IMAP and with Apache
1.3.19, on a RedHat (6.2) system.
Once IMAP is compiled, and you've exported the LDFLAGS (above), run
ldconfig before compiling PHP & Apache, then and only then it worked.
Regards,
paule.
|
|
04-May-2001 01:57 |
|
To activate quota support from the IMAP library, it is necessary to specify
the directory for the files c-client.a and *.h, because the above
mentioned header files are not enough for a successful compilation. e.g.
./configure --with-imap=../imap-2000c
|
|
24-May-2001 11:17 |
|
If you want to get PHP 4.0.5 to work with IMAP and Sybase, you may have to
rename some of the imap functions in the library source code, because they
conflict with functions of the same name in Sybase.
Search for everything starting with tcp_ and replace it by e.g. cc_tcp_.
Otherwise, the imap_open function won't be able to connect.
|
|
25-May-2001 06:43 |
|
The IMAP Client API does not login to Cyrus POP3 Servers correctly, Only
getting the capablities of the Cyrus server ie:
C:CAPA
S:+OK List of capabilities follows
S:STLS
S:EXPIRE 2
S:LOGIN-DELAY 0
S:TOP
S:UIDL
S:PIPELINING
S:RESP-CODES
S:USER
S:IMPLEMENTATION Cyrus POP3 server v2.0.13
S:.
Instead of somthing like this:
C:CAPA
S: ****
C:USER aaa
S: ****
C:PASS aaa
S: ****
C:LIST aaa
S: ****
C:QUIT aaa
S: ****
This is strange since it works for other pop3 servers
|
|
12-Jun-2001 09:29 |
|
for install imap for php4 pls refer
the install instruction as:
under php-x.x.x directory:
./configure --enable-track-vars --enable-force-cgi-redirect
--with-gettext
mv php /your.httpd/cgi-bin
add:
AddType application/php4script .php
Action application/php4script /cgi-bin/php
to your httpd.conf
then restart httpd
|
|
14-Jun-2001 06:57 |
|
I have RedHat 7.1 with imap-2000-9 and imap-devel-2000-9 rpms installed and
I tried to install php with imap support following some advices posted in
this list but I could't get it works.
What I did to get it works was:
In the php configure script I put this options:
./configure --with-apache=../apache_1.3.20 --with-imap
--with-ssl=../openssl-0.9.6a --with-kerberos
After executing the apache configure script I put this options in the
src/Makefile inmmediatly after lmodphp4:
-lc-client -lssl
And now It works!!!
|
|
26-Jun-2001 07:20 |
|
I've just upgraded from PHP 4.0.5 to 4.0.6 compiled with IMAP support.
With all versions up to 4.0.5 I have been able to keep with the old UW
IMAP 4-4 client libraries, but the IMAP changes in 4.0.6 appear to require
the IMAP 2000 series client. Upgrading to IMAP-2000c worked fine for me.
Hope this helps someone!
|
|
19-Jul-2001 02:17 |
|
If you are having problems with "segmentation fault (core
dumped)" errors when using the imap functions, probably you are using
the qpopper pop server. The qpopper aparently sends a invalid return
message when opening a conection with imap_open() function. Try to
substitute the qpopper with another server like tpop or imap instead.
|
|
27-Aug-2001 02:30 |
|
Various functions including imap_headerinfo() and
imap_rfc822_parse_adrlist() were buggy because I had downloaded the very
latest version of c-client.
Look carefully at
and you'll find an "old" directory containing previous
versions.
imap-2000c.tar.Z worked much better for me; build it and then recompile
php by including --with-imap=../imap-2000c in your configure args.
|
|
06-Sep-2001 03:33 |
|
Yes! Using the imap 2000c plus php 4.0.6 version works!
No need to do that export and ldconfig thing.
(Tried it under Mandrake 7.2)
|
|
10-Sep-2001 01:19 |
|
I can only repeat what others said. DON�T USE THE LATEST C-CLIENT!!!!
all my imap php programs refused to work and even the mtest bundled with
the WU-Imap refused to connect to my Cyrus Imapd. but the Imap-2000c
works. and even the mtest program works!
|
|
13-Sep-2001 05:55 |
|
I have successfully compile php with imap under RedHat 7.1. This is my
step:
1. export CFLAGS="-I/usr/include/imap"
2. export LDFLAGS=-lc-client
3. ./configure --enable-versioning --with-apxs=/usr/local/apache/bin/apxs
--with-mysql=/usr/local --enable-tracks-vars --with-imap --with-xml
--with-gd --with-jpeg-dir=/usr --with-kerberos --with-openssl
4. make
5. make install
|
|
22-Oct-2001 01:11 |
|
I have found the order in which you connect to you POP server with IMAP
2000 and your database with PostgreSQL 7.1.2 can cause problems.
Make sure that you connect first to your POP server then get your db
connection. This will prevent you from getting an invalid stream from
imap_open().
|
|
02-Nov-2001 04:38 |
|
Compiling in IMAP support.
I recently successfully compiled in IMAP support for PHP4.0.6 statically
compiled into apache on my FreeBSD4.3 box. I did this using the most
recent version of c-client(2001a/RC2). Originally I got loads of
"call to undefined....blahblah" errors.
The solution was this:
d/l, configure, and make the c-client library. (you do not need to make
install)
Create 2 directories under the c-client subdirectory, lib/ and include/.
Copy c-client.a into lib and rename it to libc-client4.a.
Copy rfc822.h, mail.h, and linkage.h into include/.
Configure PHP with the path to the c-client subdir in the imap option
(--with-imap=/tmp/dircreatedbyuntar/c-client).
make and make install for php.
After this, the configure and make for apache went normally.
This worked fine for me on my BSD box, I assume that it would work in
Linux as well, though I am not familliar enough with it to say for sure
|
|
03-Nov-2001 07:42 |
|
I just found something a bit bizarre. I was having problems with the pages
taking too long to load (15-20sec) when they opened an imap connection. I
was pulling my hair out trying to figure out what was wrong.
Turns out it was quite simple. I was letting it default to 143 for the
port. When i specified the port number (i.e. {localhost:143} rather than
{localhost} ) It reduced page load time to a few seconds.
|
|
20-Nov-2001 11:22 |
|
to get apache 1.3.22 to work with php-3.0.8, php-4.0.6 and imap
(imap-devel-2000c-15 from RPM) on redhat-7.2, try doing
export LDFLAGS="-L/usr/kerberos/lib -lkrb5 -lgssapi_krb5 -lpam -lz
-lssl"
before compiling apache and both php modules.
|
|
10-Dec-2001 01:07 |
|
How to build PHP for IMAP support on FreeBSD-4.2+:
1. Update your ports tree. (Read the Handbook if you don't know how)
2. pkg_delete cclient (pkg_info for the complete name). Perhaps you have
to remove pine aswell, as it requires cclient.
3. cd /usr/ports/mail/cclient; make install
3.1 cd /usr/ports/mail/pine; make install (if you removed pine earlier)
4. Copy c-client.a from
/usr/ports/mail/cclient/work/imap-2001a/c-client/c-client.a to
/usr/local/lib
5. cd php-dir; ./configure [your options] --with-imap=/usr/local
--with-apache=[apache dir]
6. make install
7. cd [apache dir]
8. config, make
9. Done.
|
|
13-Dec-2001 06:06 |
|
To fully support the last UW IMAP version 2001a here are the contents of
the directory I used as DIR for --with-imap:
include/c-client.h
include/env.h
include/env_unix.h
include/2000 fs.h
include/ftl.h
include/imap4r1.h
include/linkage.h
include/mail.h
include/misc.h
include/nl.h
include/nntp.h
include/os_slx.h
include/osdep.h -> os_slx.h
include/rfc822.h
include/smtp.h
include/tcp.h
lib/c-client.a
lib/libc-client.a -> c-client.a
|
|
29-Dec-2001 02:36 |
|
OS version: Debian GNU/Linux "Potato"
Apache version: 1.3.22
After reading the notes here and bangind my head against the wall a bit, I
found that all I needed to do was remove /usr/lib/libc-client.so.* in
order to get apache's configure to work.
|
|
15-Jan-2002 09:01 |
|
For IMAP installation on cobalt RAQ4:
cp c-client.a /usr/lib
cp rfc822.h mail.h linkage.h /usr/include
This should also work for Red Hat. The example given above doesnt work for
me.
|
|
31-Jan-2002 04:02 |
|
Here�s how I installed php4.1.1 with mysql and imap support for apache
1.3.19. I hope it help you.
I used:
./configure --with-apxs=/usr/local/apache/bin/apxs --with-mysql
--with-imap --with-kerberos --with-imap-ssl
and it worked fine but i got this error during make:
/usr/bin/ld: cannot find -lgssapi_krb5
collect2: ld returned 1 exit status
make[1]: *** [libphp4.la] Error 1
make[1]: Leaving directory `/root/tars/php-4.1.1'
make: *** [all-recursive] Error 1
When exporting env vars (export LDFLAGS="-L/usr/kerberos/lib -lkrb5
-lgssapi_krb5 -lpam") i get: checking whether the C compiler (gcc
-L/usr/kerberos/lib -lkrb5 -lgssapi_krb5 -lpam) works... no
configure: error: installation or configuration problem: C compiler cannot
create executables.
Obviously, this didn�t work, I simply installed krb5-devel and reinstalled
without exporting the env var.
This allowed me to compile successfully, but when I started apache I got
Cannot load /usr/local/apache/libexec/libphp4.so into server: undefined
symbol:pam_end
I checked to make sure the libraries were linked properly:
The cause for this was not having libpam_devel installed. Make sure that
if you clear config.cache and run make clean after configure.
Install krb5-devel
Install libpam �devel
ldconfig
./configure --with-apxs=/usr/local/apache/bin/apxs --with-mysql
--with-imap --with-kerberos --with-imap-ssl
make clean
make
make install
if you come into any other errors, try installing the devel packages and
recompiling don�t forget to remove config.cache before each compile
attempt.
|
|
21-Feb-2002 04:47 |
|
I have downloaded IMAP webmail and tried to install it. My configuration is
Slackware 8 with Apache 1.3.20. Webmail require PHP 4.1.1 so I download it
and compile with options:
./configure --with-mysql --with-apxs --enable- trans-sid --with-gettext
--with-imap=/usr/local/lib --with-imap-ssl=/usr/local/lib
I use c-client from imap-2001a and have libc-client.a in /usr/locla/lib.
When I tried to run Webmail I always got error " TLS/SSL failure for
localhost: SSL negotiation failed". I note that there is no request
to IMAP server, so the problems is in the c-client itself. After a few
hours tests and many READMEs I found in c-client documentation that the
correct url for IMAP connection is
{imapserver:143/notls}INBOX
/notls is to disable TLS connection.
Hope this will help someone and save him/her a lot of time and headache :)
|
|
16-Apr-2002 05:30 |
|
there are a nice pop3/imap Tutorial @ devhed
have fun
|
|
30-Apr-2002 03:40 |
|
Just fought php compile 4.2.0 on RH7.1 linux w/IMAP. Had to include
/usr/include/imap/ into lib path and had to manually configure
--with-kerberos to satisfy c-client.h which had Kerberos in it. My
c-client was from RH .rpm. HTH
|
|
15-May-2002 05:24 |
|
The tutorial from DevShed.com is awesome! I recommend it to all PHP
developers!
|
|
17-May-2002 11:42 |
|
I was going crazy trying to get PHP 4.2.1 to work with the imap-2001a
c-client in RH-7.2.
The problem was the instructions provided by PHP. Do NOT copy c-client/*.h
to /usr/local/include! Make will crash when it tries to include unix.h.
Instead, only copy the following:
cp c-client.a /usr/local/lib
cp rfc822.h mail.h linkage.h /usr/local/include
This was what the old instructions for this said, but someone revised them
in the last month or so.
I used the shared module install instructions found here, compiled mcrypt
and imap (with ssl support), and then used the following for configure:
--enable-dbase --with-mysql=/usr/local/mysql --with-zlib --enable-ftp
--with-mcrypt=/usr/local/lib --enable-trans-sid
--with-apxs=/usr/local/apache/bin/apxs --with-imap --with-kerberos
--with-imap-ssl
|
|
22-May-2002 05:16 |
|
please don't copy the .h files in the system include directory! the unix.h
file from the washington.edu c-client conflicts with another file called
unix.h
make a dir called "imap" in either /usr/include or
/usr/local/include or whatever you wish, copy the header files there and
the .a file prefix'ish in /usr/lib or /usr/local/lib or whatever you used
for the include files.
then tell configure with --with-imap=/usr the "prefix" of your
installation.
then works without problem ;)
|
|
07-Jun-2002 07:27 |
|
I just installed c-client from imap-2002.DEV.SNAP-0205241716. To make it
work on my GNU/Linux system (2.4 kernel, glibc 2.2.5), I had to edit the
imap source.
In the file src/osdep/unix/tcp_unix.c, I changed the function
tcp_socket_open to run getprotobyname("tcp") instead of
"ip".
Suddenly I was able to make IMP work for the first time in several months.
:)
Sverre.
|
|
10-Jun-2002 03:20 |
|
RH7.2, PHP 4.2.1, Apache 2.0.36. Installed all "whistles"
required - pam-dev, kerberos, ssl, copied .h and .a files, still was
having "unable to load libphp4.so, undefined pam_end". What I
changed in my ./configure - got rid of "--with-openssl", on my
humble opinion Apache needs to be configured with ssl support, otherwise
it will swear at you as it did at me :). After that everything went ok.
|
|
22-Jun-2002 04:02 |
|
Suse 8.0 for Intel, Apache 1.3.26, PHP 4.2.1, Mod_ssl, et al...
The note from the Debian guy was the answer. I discovered two things:
#1. You have to specify BOTH --with-imap AND --with-imap-ssl - NOT JUST
the ssl one!
#2. You have to remove or rename /usr/lib/libc-client.so so it uses the
static version.
Those two things solved it for me!
|
|
28-Jun-2002 05:02 |
|
On Solaris 8, php mistakenly sets unix.h to yes. This is due to configure
getting confused about whether 'cc' is available.
setenv CC gcc; Will fix this.
?num=3&id=111236&thread=111226
|
|
|