PHP  
downloads | documentation | faq | getting help | mailing lists | | php.net sites | links | my php.net 
search for in the  
<read_exif_dataimap_8bit>
view the version of this page
Last updated: Tue, 22 Apr 2003

XLII. IMAP, POP3 and NNTP functions

Introductie

These functions are not limited to the IMAP protocol, despite their name. The underlying c-client library also supports NNTP, POP3 and local mailbox access methods.

Afhankelijkheden

This extension requires the c-client library to be installed. Grab the latest version from and compile it.

It's important that you do not copy the IMAP source files directly into the system include directory as there may be conflicts. Instead, create a new directory inside the system include directory, such as /usr/local/imap-2000b/ (location and name depend on your setup and IMAP version), and inside this new directory create additional directories named lib/ and include/. From the c-client directory from your IMAP source tree, copy all the *.h files into include/ and all the *.c files into lib/. Additionally when you compiled IMAP, a file named c-client-a was created. Also put this in the lib/ directory but rename it as libc-client.a.

Opmerking: To build the c-client library with SSL or/and Kerberos support read the docs supplied with the package.

Installatie

To get these functions to work, you have to compile PHP with --with-imap[=DIR], where DIR is the c-client install prefix. From our example above, you would use --with-imap=/usr/local/imap-2000b. This location depends on where you created this directory according to the description above.

Opmerking: Depending how the c-client was configured, you might also need to add --with-imap-ssl=/path/to/openssl/ and/or --with-kerberos=/path/to/kerberos into the PHP configure line.

Waarschuwing

The IMAP extension cannot be used in conjuction with the recode or YAZ extensions. This is due to the fact that they both share the same internal symbol.

Configuratie tijdens scriptuitvoer

Deze extensie gebruikt geen configuratie regels.

Resource types

Voorgedefineerde constanten

Deze constanten worden gedefineerd door deze extensie, en zullen alleen beschikbaar zijn als de extensie met PHP is meegecompileerd, of als deze dynamisch is geladen vanuit een script.

NIL (integer)

OP_DEBUG (integer)

OP_READONLY (integer)

OP_ANONYMOUS (integer)

OP_SHORTCACHE (integer)

OP_SILENT (integer)

OP_PROTOTYPE (integer)

OP_HALFOPEN (integer)

OP_EXPUNGE (integer)

OP_SECURE (integer)

CL_EXPUNGE (integer)

FT_UID (integer)

FT_PEEK (integer)

FT_NOT (integer)

FT_INTERNAL (integer)

FT_PREFETCHTEXT (integer)

ST_UID (integer)

ST_SILENT (integer)

ST_SET (integer)

CP_UID (integer)

CP_MOVE (integer)

SE_UID (integer)

SE_FREE (integer)

SE_NOPREFETCH (integer)

SO_FREE (integer)

SO_NOSERVER (integer)

SA_MESSAGES (integer)

SA_RECENT (integer)

SA_UNSEEN (integer)

SA_UIDNEXT (integer)

SA_UIDVALIDITY (integer)

SA_ALL (integer)

LATT_NOINFERIORS (integer)

LATT_NOSELECT (integer)

LATT_MARKED (integer)

LATT_UNMARKED (integer)

SORTDATE (integer)

SORTARRIVAL (integer)

SORTFROM (integer)

SORTSUBJECT (integer)

SORTTO (integer)

SORTCC (integer)

SORTSIZE (integer)

TYPETEXT (integer)

TYPEMULTIPART (integer)

TYPEMESSAGE (integer)

TYPEAPPLICATION (integer)

TYPEAUDIO (integer)

TYPEIMAGE (integer)

TYPEVIDEO (integer)

TYPEOTHER (integer)

ENC7BIT (integer)

ENC8BIT (integer)

ENCBINARY (integer)

ENCBASE64 (integer)

ENCQUOTEDPRINTABLE (integer)

ENCOTHER (integer)

Zie ook

This document can't go into detail on all the topics touched by the provided functions. Further information is provided by the documentation of the c-client library source (docs/internal.txt). and the following RFC documents:

  • : Simple Mail Transfer Protocol (SMTP).

  • : Standard for ARPA internet text messages.

  • : Internet Message Access Protocol (IMAP) Version 4rev1.

  • : Post Office Protocol Version 3 (POP3).

  • : Network News Transfer Protocol (NNTP).

  • : Common Internet Message Headers.

  • , , , & : Multipurpose Internet Mail Extensions (MIME).

A detailed overview is also available in the books by David Wood and by Dianna Mullet & Kevin Mullet.

Inhoudsopgave
imap_8bit --  Convert an 8bit string to a quoted-printable string
imap_alerts --  This function returns all IMAP alert messages (if any) that have occurred during this page request or since the alert stack was reset
imap_append --  Append a string message to a specified mailbox
imap_base64 -- Decode BASE64 encoded text
imap_binary --  Convert an 8bit string to a base64 string
imap_body -- Read the message body
imap_bodystruct --  Read the structure of a specified body section of a specific message
imap_check -- Check current mailbox
imap_clearflag_full -- Clears flags on messages
imap_close -- Close an IMAP stream
imap_createmailbox -- Create a new mailbox
imap_delete --  Mark a messge for deletion from current mailbox
imap_deletemailbox -- Delete a mailbox
imap_errors --  This function returns all of the IMAP errors (if any) that have occurred during this page request or since the error stack was reset.
imap_expunge -- Delete all messages marked for deletion
imap_fetch_overview --  Read an overview of the information in the headers of the given message
imap_fetchbody --  Fetch a particular section of the body of the message
imap_fetchheader -- Returns header for a message
imap_fetchstructure --  Read the structure of a particular message
imap_get_quota --  Retrieve the quota level settings, and usage statics per mailbox
imap_get_quotaroot --  Retrieve the quota settings per user
imap_getmailboxes --  Read the list of mailboxes, returning detailed information on each one
imap_getsubscribed -- List all the subscribed mailboxes
imap_header -- Alias of imap_headerinfo()
imap_headerinfo -- Read the header of the message
imap_headers --  Returns headers for all messages in a mailbox
imap_last_error --  This function returns the last IMAP error (if any) that occurred during this page request
imap_list -- Read the list of mailboxes
imap_listmailbox -- Alias of imap_list()
imap_listscan --  Read the list of mailboxes, takes a string to search for in the text of the mailbox
imap_listsubscribed -- Alias of imap_lsub()
imap_lsub -- List all the subscribed mailboxes
imap_mail_compose --  Create a MIME message based on given envelope and body sections
imap_mail_copy -- Copy specified messages to a mailbox
imap_mail_move -- Move specified messages to a mailbox
imap_mail --  Send an email message
imap_mailboxmsginfo -- Get information about the current mailbox
imap_mime_header_decode -- Decode MIME header elements
imap_msgno --  This function returns the message sequence number for the given UID
imap_num_msg --  Gives the number of messages in the current mailbox
imap_num_recent -- Gives the number of recent messages in current mailbox
imap_open -- Open an IMAP stream to a mailbox
imap_ping -- Check if the IMAP stream is still active
imap_qprint -- Convert a quoted-printable string to an 8 bit string
imap_renamemailbox -- Rename an old mailbox to new mailbox
imap_reopen -- Reopen IMAP stream to new mailbox
imap_rfc822_parse_adrlist -- Parses an address string
imap_rfc822_parse_headers -- Parse mail headers from a string
imap_rfc822_write_address --  Returns a properly formatted email address given the mailbox, host, and personal info.
imap_scanmailbox -- Alias of imap_listscan()
imap_search --  This function returns an array of messages matching the given search criteria
imap_set_quota -- Sets a quota for a given mailbox
imap_setacl --  Sets the ACL for a giving mailbox
imap_setflag_full -- Sets flags on messages
imap_sort -- Sort an array of message headers
imap_status --  This function returns status information on a mailbox other than the current one
imap_subscribe -- Subscribe to a mailbox
imap_thread --  Return threaded by REFERENCES tree
imap_uid --  This function returns the UID for the given message sequence number
imap_undelete --  Unmark the message which is marked deleted
imap_unsubscribe -- Unsubscribe from a mailbox
imap_utf7_decode --  Decodes a modified UTF-7 encoded string.
imap_utf7_encode --  Converts ISO-8859-1 string to modified UTF-7 text.
imap_utf8 --  Converts MIME-encoded text to UTF-8


User Contributed Notes
IMAP, POP3 and NNTP functions
add a note add a note
mcdermam at potsdam dot edu
29-Mar-1999 03: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.
flec at flec dot co dot uk
06-Sep-1999 03: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.
rfg at monkeys dot com
19-Sep-1999 01: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.

nathan at synop dot com
21-Sep-1999 09:46

I've written <a href=">instructions for installing IMAP support on Red Hat</a> (amongst other things) that might help you get started.
php at support dot proweb dot net
14-Nov-1999 12: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>
&lt;?php
$mbox = imap_open("{localhost:143}INBOX", "username", "password");
if ($hdr = imap_check($mbox)) {
   echo "Num Messages " . $hdr->Nmsgs;
}
else {
      echo "failed";
}
?>
</pre>

jack at ontraque dot com
03-Dec-1999 09: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.
mason_php at fivespeed dot com
29-Dec-1999 08: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.

rlynch at ignitionstate dot com
25-Jan-2000 08: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.)

ccunning at math dot ohio-state dot edu
03-Apr-2000 05: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.

grauker at nd dot edu
28-Jul-2000 02: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

Pilot at gamers dot at
27-Feb-2001 12: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..

paule at paule dot net
08-Apr-2001 12: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.

terence at vol dot net
04-May-2001 02: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
mheumann at sei dot cl
25-May-2001 12: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 07: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

ngahleng at yahoo dot com
12-Jun-2001 10: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

hernanm at la14 dot com
14-Jun-2001 07: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!!!

nickt at powys dot gov dot uk
26-Jun-2001 08: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!
lasher at linkexpress dot com dot br
19-Jul-2001 03: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.
beetle80 at lineone dot net
27-Aug-2001 03: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.

eesc at fil-web dot com
06-Sep-2001 04: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)

php dot net at evilazrael dot de
10-Sep-2001 02: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 06: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

raoul at runtheotherway dot com
22-Oct-2001 02: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().

netshadow at madpoets dot org
02-Nov-2001 05: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

netshadow at madpoets dot org
03-Nov-2001 08: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.

ondrej-phpnet at ll dot cz
21-Nov-2001 12: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.

origo at NOSPAM dot spray dot se
10-Dec-2001 02: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.

armitage at freaks dot com
29-Dec-2001 03: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.

php at chikki dot net
15-Jan-2002 10: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.

bcross at xcalibr dot org
31-Jan-2002 05: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.

toshe_bg at yahoo dot com
21-Feb-2002 05: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 :)

try at linuxplanet dot nu
16-Apr-2002 06:30

there are a nice pop3/imap Tutorial @ devhed



have fun

fenster at adams dot org
30-Apr-2002 04: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
kmakaveev at yahoo dot com
15-May-2002 06:24

The tutorial from DevShed.com is awesome! I recommend it to all PHP developers!
todd at nbm dot com
18-May-2002 12: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

duckel at electroporn dot de
22-May-2002 06: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 ;)

shh+php at thathost dot com
07-Jun-2002 08: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.

zimine at zhapon dot com
10-Jun-2002 04: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.
glen at NOSPAM dot ldscn dot com
22-Jun-2002 05: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 06: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

alex at cite dot gda dot itesm dot mx
11-Jul-2002 12:52

I needed imap support, and most configurations of php say that imap2001a has ssl, so you need to use --with-imap-ssl or --with-kerberos. But after getting a nasty error in apachectl start like: undefined symbol: ssl_onceonlyinit, or something, this is what I did:

1. NOT use --with-imap-ssl (sorry if you need this, I have no idea how to make this option work)
2. use --with-imap=DIR, where DIR has all of these:

include/c-client.h
include/env.h
include/env_unix.h
include/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

[
just in case, one.a -> two.a is a link, created with "ln -s two.a one.a"
]

3. remove /path/to/php-inst/config.cache
4. remove /path/to/apache/libexec/libphp4.so
5. do /path/to/php-inst/make clean

then configure, make and make install

Cheers!

AlexM.

crobinsoNOSPAM.at.fit.edu
17-Jul-2002 11:02

Build Notes for PHP IMAP:
To Build c-client with SSL.
Versions:
imap-2002RC2
php-4.2.1
apache-1.3.26

IMAP c-client building:
1. extract imap-2002.RC.tar.Z
2. cd imap-2002.RC2
3. make <build type> SSLTYPE=unix
   <build type> described in Makefile
4. Modify src/osdep/unix/Makefile for SSLDIR,  SSLCRYPTO, and SSLRSA
5. ln -s c-client include
6. mkdir lib
7. cd lib
8. ln -s ../c-client/c-client.a libc-client.a
9. cd ..

PHP Build:
1. cd php-4.2.1
2. ./configure --with-imap=../imap-2002.RC2 \
--with-imap-ssl=../imap-2002.RC2 \
<other options>
3. make
4. make install
5. cd ..

Then you should be good to go.

rune at bummer dot imptech dot net
24-Jul-2002 12:28

Installing on a FreeBSD 4.4 box with Apache:

Do this if you don't have cclient-200x installed already
(installed if you have PINE, etc. setup). Use pkg_info
to see if it's already installed.

01) cd /usr/ports/mail/cclient
02) make
03) cd work/imap-2001a/c-client
04) cp c-client.a /usr/local/lib
cp c-client.h /usr/local/include
cp imap4r1.h /usr/local/include
cp rfc822.h /usr/local/include
cp mail.h /usr/local/include
cp linkage.h /usr/local/include
cp osdep.h /usr/local/include
cp misc.h /usr/local/include
cp smtp.h /usr/local/include
cp nntp.h /usr/local/include
cp env_unix.h /usr/local/include
cp fs.h /usr/local/include
cp ftl.h /usr/local/include
cp nl.h /usr/local/include
05) cd to your PHP source dir.
06) ./configure [your options] --with-imap=/usr/local
07) make
08) apachectl stop
09) make install
10) apachectl start

You should be good to go now. Aren't you glad I've screwed with
this for the past few months off and on trying to make it work
now.  :)

-=- RuneImp
ImpTech - Web Design, Hosting & Computer Tech

rune at bummer dot imptech dot net
24-Jul-2002 12:30

Installing on a FreeBSD 4.4 box with Apache:

Do this if you DO have cclient-200x installed already
(installed if you have PINE, etc. setup). Use pkg_info
to see if it's already there.

1) ./configure [your options] --with-imap
2) make
3) apachectl stop
4) make install
5) apachectl start

You should be good to go now.  :)

-=- RuneImp
ImpTech - Web Design, Hosting & Computer Tech

rezzo-at-ngi-dot-it
25-Jul-2002 02:25

There's a solution to the Apache loading error:

/usr/local/libexec/apache/libphp4.so:
 Undefined symbol "ssl_onceonlyinit"

In this case you have to recompile the cclient package with SSL support. So, for FreeBSD users:

 # pkg_delete [-f] cclient-2001a,1
 # cd /usr/ports/mail/cclient/
 # make clean
 # make install -D WITH_SSL

After that Apache, PHP and IMAP+SSL should work correctly.

thor at thrudhame dot net
11-Sep-2002 02:50

By installing imap2000.RC5
I need this .h files in my /usr/local/include

c-client.h
imap4r1.h
mail.h
linkage.h
rfc822.h
osdep.h
misc.h
smtp.h
nntp.h
env_unix.h
fs.h
ftl.h
nl.h
env.h
tcp.h

linn at dybnet dot de
15-Oct-2002 10:57

I just got PHP 4.2.3 installed with IMAP support.
My problem was pam_start/pam_end.
Just compile c-client (doesn�t matter which version, I have imap-2002.RC2) without PAM support (e.g. make slx SSLTYPE=unix).
You don�t need to run make install just create lib and include in c-client directory.
Then run PHP configure --with-imap=/path/to/the/c-client-dir and --with-imap-ssl.
Works great for me. Hope this helps...

31-Oct-2002 09:11
Red Hat 7.2 Users: I had a tough time getting IMAP to work, even though compilation worked without errors, and function calls appeared to be recognized, though I could never get a POP3 connection!

There's an unreported error in IMAP... In order to use POP3 and RH's IMAP function, you have to pass a URL like this:

'{mail.server.com:110/pop3/novalidate-cert}INBOX'

Getting PHP 4.2.3+IMAP using the IMAP RPMs:

1) Make sure you have imap-devel RPM loaded.

2) Compile PHP with "--with-imap=/usr --with-imap-ssl --with-kerberos". No need to copy c-client files. You might be able to get away with just "--with-imap --with-imap-ssl --with-kerberos".

3) Use the above mangled address with the "/novalidate-cert" suffix.

Now, given the above, why isn't there a value in php.ini to toggle this behavior, and why is there NO documentation that this is required?

talmage at usi-rpg dot com
03-Nov-2002 08:38

I searched for a few hours, and finally gave up looking for a way to get the acl on a mailbox w/a single imap function.

I have come up with three solutions:

1. telnet into your imap server (localhost:143) using fsockopen and use the "GETACL" command to get the acl on the mailbox you want.

2. telnet into your shell(localhost) using fsockopen, open cyradm and get the acl that way.

3. Wait for 4.3 to be released, and use proc_open to control cyradm w/o the telnetting thing.

If anyone has a better method, please do enlighten me.

ibyte at REMOVETHISsuespammers dot org
22-Nov-2002 03:08

A note to Windows users: if PHP complains about undefined functions, but you have downloaded the many-extension version of PHP and therefore have php_imap.dll in your extensions folder, you can load it using dl('php_imap.dll');
See the dl() function for details.

peter at bleepbleep.org.uk
23-Nov-2002 10:20

When I tried to compile the imap-2002 libraries into php (using --with-imap-ssl & --with-imap) the ./configure dit not complain, but the make moaned about a lack of flocksim.h .  Copying this across from imap-2002/c-client to /usr/local/include fixed this.
naveed at php dot net
12-Jan-2003 02:49

Beware!
If you are trying to make a connection with POP3 mailbox,then some of IMAP functions will not work correctly as you might expecting .This is because the difference of workings in POP3 and IMAP protocols.
These functions work correctly for IMAP mailboxes but some of the fnctions will return nothing, when connected to a POP3 mailbox.(even no error message).

rebQQtZ - simonp at tin it
24-Feb-2003 11:01

This script has worked fine for me while
installing under FreeBSD 4.7, just cut & paste ...
tnx to rfg & rune

#!/bin/sh

IMAP=imap-2001a
CCLIENTDIR=/usr/ports/mail/cclient
IMAPDIR=$CCLIENTDIR/work/$IMAP
IMAPLIBDIR=/usr/local/$IMAP

mkdir $IMAPLIBDIR
mkdir $IMAPLIBDIR/include
mkdir $IMAPLIBDIR/lib

cd $CCLIENTDIR
make

cd $IMAPDIR/c-client
cp c-client.a $IMAPLIBDIR/lib
cp c-client.h $IMAPLIBDIR/include
cp imap4r1.h $IMAPLIBDIR/include
cp rfc822.h $IMAPLIBDIR/include
cp mail.h $IMAPLIBDIR/include
cp linkage.h $IMAPLIBDIR/include
cp osdep.h $IMAPLIBDIR/include
cp misc.h $IMAPLIBDIR/include
cp smtp.h $IMAPLIBDIR/include
cp nntp.h $IMAPLIBDIR/include
cp env_unix.h $IMAPLIBDIR/include
cp fs.h $IMAPLIBDIR/include
cp ftl.h $IMAPLIBDIR/include
cp nl.h $IMAPLIBDIR/include

cd /usr/ports/www/mod_php4
make deinstall
make clean
sh scriptst/configure.php
make --with-imap=$IMAPLIBDIR

apachectl stop
make install
apachectl start

keeper at odi dot com dot br
01-Mar-2003 07:37

For those working with mail talke a look ate the pear class
Mime decode:



Dotrinador

designer at bs-dee dot org
09-Mar-2003 11:27

The only c-client that has worked 100% with php is



DO NOT DOWNLOAD 2002 B its BUGGY!

ofeet at hotmail dot com
19-Mar-2003 06:01

bleh! I was getting errors! here's how I fixed it.

ps I'm using redhat8.0 with apache2.0

when using:
imap_open ("{localhost:143}INBOX", "user", "pass");

I recieved:
Warning: Couldn't open stream {localhost:143}INBOX

This is because of TLS, I think it was on by default starting with RH7.3. Anyway do fix this you have to use:

imap_open ("{localhost:143/notls}INBOX", "user", "pass");

Theres already a not similar to this, but I hope this broadens your perception of what's going on. (probably not)

framacciani at netcat dot it
26-Mar-2003 10:49

I'm tried to install various version of c-client and the most does not work because it have some bugs and need unconventional patch.

I resolve my problem when i try to install this version of c-client:


It works without any patch.

Fabio Ramacciani

rudi at who dot net
26-Mar-2003 11:30

I followed the install instructions at the top
of this page exactly.
It works perfect first time on my Debian 3 box.
There's a lot of comments on how to install PHP
with IMAP but all I know is the instructions at
the top of the page work for me
Cheers

as1 at powersite dot com dot ar
02-May-2003 06:28

How can I do if I have multi mime headers?
By example:

Content-Type: multipart/related;
                type="multipart/alternative";
or:

Content-Type: multipart/mixed;
                type="multipart/alternative";

or both methods: nested and multi mime headers:

Content-Type: multipart/mixed;
    boundary="147147"

--147147
Content-Type: multipart/related;
      type="multipart/alternative";
   boundary="247247"

These headers are used when you need attach files and
insert files in a body into mime mails.

add a note add a note

<read_exif_dataimap_8bit>
 Last updated: Tue, 22 Apr 2003
show source | credits | mirror sites 
Copyright © 2001-2003 The PHP Group
All rights reserved.
This mirror generously provided by: /
Last updated: Sun May 25 21:10:51 2003 CEST