Re: PHP + IMAP
| From: | Hans Kind | Date: | Tue, 14 Nov 2000 07:50:16 +0000 |
| Subject: | Re: PHP + IMAP | ||
| Groups: | php.install | ||
| Request: | Send a blank email to php-install+get-768@lists.php.net to get a copy of this message | ||
Hi Matthew,
A simple script (attached) I use to test the IMAP functions from PHP:
Change #username# and #password# to your values.
I assume you did install the c-client library. See
http://us4.php.net/manual/html/ref.imap.html.
rgds
Hans Kind.
<HTML>
<HEAD>
<TITLE>imap_check</TITLE>
</HEAD>
<BODY>
<?
//check for new messages
$mailbox = imap_open("{localhost/pop3:110}INBOX",
"#username#","#password#");
// Check messages
$check = imap_check($mailbox);
print("<PRE>");
print("Date most recent message : " . $check->Date);
print("<BR>");
print("Connection type : " . $check->Driver);
print("<BR>");
print("Name of the mailbox : " . $check->Mailbox);
print("<BR>");
print("Number of messages : " . $check->Nmsgs);
print("<BR>");
print("Number of recent messages : " . $check->Recent);
print("<BR>");
print("</PRE>");
// show headers for messages
$index=1;
$header = imap_header($mailbox, $index);
print("<PRE>");
print("Header Date : " . $header->Date . "<BR>");
print("Header To : " . $header->to) . "<BR>";
print("Header From : " . $header->From . "<BR>");
print("Header cc : " . $header->cc . "<BR>");
print("Header ReplyTo : " . $header->ReplyTo . "<BR>");
print("Header Subject : " . $header->Subject .
"<BR></PRE>");
print("<PRE>");
print(imap_body($mailbox,$index));
print("</PRE><HR>");
imap_close($mailbox);
?>
</BODY></HTML>
At 12:25 14-11-00 +1100, you wrote:
>Hi,
>
>I am currently trying to install PHP to include IMAP support.
>
>Is there an easy way to ensure that this has configured in correctly, and
>PHP _does_ support IMAP?
>
>To get it installed, I am doing ...
>
>./configure --with-imap
>make && make install
>
>I am attempting at getting IMP Web Mail running (http://www.horde.org/imp)
>which requires PHP with IMAP support.
>
>I am using FreeBSD 3.3 STABLE, Apache 1.3.14, PHP 4.0.2 (have also tried PHP
>4.0.3pl1 as well).
>
>Any suggestions / assistance, would be gratefully accepted.
>
>Thanks in advance,
>Matthew
>
>PS: I have looked through the mailing list archives, and didn't seem to find
>anything that would suit my problem, unless I have missed something ..
>Thanks.
>
>
>--
>PHP Install Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-install-unsubscribe@lists.php.net
>For additional commands, e-mail: php-install-help@lists.php.net
>To contact the list administrators, e-mail: php-list-admin@lists.php.net
<HTML> <HEAD> <TITLE>imap_check</TITLE> </HEAD> <BODY> <? //check for new messages $mailbox = imap_open("{localhost/pop3:110}INBOX", "kins","lordyMee"); // Check messages $check = imap_check($mailbox); print("<PRE>"); print("Date most recent message : " . $check->Date); print("<BR>"); print("Connection type : " . $check->Driver); print("<BR>"); print("Name of the mailbox : " . $check->Mailbox); print("<BR>"); print("Number of messages : " . $check->Nmsgs); print("<BR>"); print("Number of recent messages : " . $check->Recent); print("<BR>"); print("</PRE>"); // show headers for messages $index=1; $header = imap_header($mailbox, $index); print("<PRE>"); print("Header Date : " . $header->Date . "<BR>"); print("Header To : " . $header->to) . "<BR>"; print("Header From : " . $header->From . "<BR>"); print("Header cc : " . $header->cc . "<BR>"); print("Header ReplyTo : " . $header->ReplyTo . "<BR>"); print("Header Subject : " . $header->Subject . "<BR></PRE>"); print("<PRE>"); print(imap_body($mailbox,$index)); print("</PRE><HR>"); imap_close($mailbox); ?> </BODY></HTML>
<HTML> <HEAD> <TITLE>imap_check</TITLE> </HEAD> <BODY> <? //check for new messages $mailbox = imap_open("{localhost/pop3:110}INBOX", "kins","lordyMee"); // Check messages $check = imap_check($mailbox); print("<PRE>"); print("Date most recent message : " . $check->Date); print("<BR>"); print("Connection type : " . $check->Driver); print("<BR>"); print("Name of the mailbox : " . $check->Mailbox); print("<BR>"); print("Number of messages : " . $check->Nmsgs); print("<BR>"); print("Number of recent messages : " . $check->Recent); print("<BR>"); print("</PRE>"); // show headers for messages $index=1; $header = imap_header($mailbox, $index); print("<PRE>"); print("Header Date : " . $header->Date . "<BR>"); print("Header To : " . $header->to) . "<BR>"; print("Header From : " . $header->From . "<BR>"); print("Header cc : " . $header->cc . "<BR>"); print("Header ReplyTo : " . $header->ReplyTo . "<BR>"); print("Header Subject : " . $header->Subject . "<BR></PRE>"); print("<PRE>"); print(imap_body($mailbox,$index)); print("</PRE><HR>"); imap_close($mailbox); ?> </BODY></HTML>