note 103902 added to function.imap-open
| From: | davidatbrayworthdotcomdotau at osu1 dot php dot net | Date: | Tue, 10 May 2011 12:28:10 +0000 |
| Subject: | note 103902 added to function.imap-open | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-179577@lists.php.net to get a copy of this message | ||
I managed to use this function against Exchange 2010 without recompiling to disable kerberos
It's important to me that php installs per the standard package (yum install php)
Exchange 2010 triggers kerberos in php, and you require the kinit thing (search around google for
"imap_open kinit exchange 2010" and you will find this)
To get it working I had to:
1. setup the krb5.conf file correctly
2. do a kinit username@DOMAIN.DOM with a valid username / password
3. rename the ticket file to reflect the user id of apache (usually 48)
/tmp/krb5cc_48
4. fix ownership
chown apache.apache /tmp/krb5cc_48
but the exchange server will use the kerberos ticket and not the username password - unless you use
ssl
<?php
$imap_user = "username";
$imap_pass = "password";
$imap_server = "{w2010kExchangeServer:993/novalidate-cert/ssl}";
$mbox = imap_open("{$imap_server}INBOX", $imap_user, $imap_pass);
$sorted_mbox = imap_sort($mbox, SORTDATE, 0);
$totalrows = imap_num_msg($mbox);
print "$imap_server\n";
$startvalue = 0;
while ($startvalue < $totalrows) {
$headers = imap_fetchheader($mbox, $sorted_mbox[ $startvalue ] );
$subject = array();
preg_match_all('/^Subject: (.*)/m', $headers, $subject);
print $subject[1][0] . "\n";
$startvalue++;
}
?>
One small step for php / exchange, one Giant leap for David ....
----
Server IP: 69.147.83.197
Probable Submitter: 202.173.189.175
----
Manual Page -- http://www.php.net/manual/en/function.imap-open.php
Edit -- https://master.php.net/note/edit/103902
Del: integrated -- https://master.php.net/note/delete/103902/integrated
Del: useless -- https://master.php.net/note/delete/103902/useless
Del: bad code -- https://master.php.net/note/delete/103902/bad+code
Del: spam -- https://master.php.net/note/delete/103902/spam
Del: non-english -- https://master.php.net/note/delete/103902/non-english
Del: in docs -- https://master.php.net/note/delete/103902/in+docs
Del: other reasons-- https://master.php.net/note/delete/103902
Reject -- https://master.php.net/note/reject/103902
Search -- https://master.php.net/manage/user-notes.php