Use PHP to read IMAP emails. This example can be used to practice IMAP functions, but if you really want to write WEBMAIL, you have to consider more than that ...... Lone Wolf login. php3? Phpif (! $ PHP_AUTH_USER) {Heade // This example can be used to practice IMAP functions.
// But if you really want to write WEBMAIL, you have to consider more than that ...... Lone Wolf
Login. php3
If (! $ PHP_AUTH_USER ){
Header ("WWW-authenticate: basic realm =" email client check "");
Header ("HTTP/1.0 401 Unauthorized ");
} Else {
$ MYDIR = ereg_replace ("/[^/] + $", "", $ PHP_SELF );
Header ("Location: $ SERVER_NAME $ MYDIR/messages. php3 ");
}
?>
This checks the user and directs the user to the user mail page.
Messages. php3
$ MAILSERVER = "{localhost/imap }";
$ Link = imap_open ($ MAILSERVER, $ PHP_AUTH_USER, $ PHP_AUTH_PW );
$ Headers = imap_headers ($ link );
For ($ x = 1; $ x <count ($ headers); $ x ++ ){
$ Idx = ($ X-1 );
Echo "$ headers [$ idx]
";
}
?>
Connect to the IMAP server $ MAILSERVER after verification
Then, retrieve the email list and create a connection to read the email.
View. php3:
$ MAILSERVER = "{localhost/imap }";
$ Link = imap_open ($ MAILSERVER, $ PHP_AUTH_USER, $ PHP_AUTH_PW );
$ Header = imap_header ($ link, $ num );
Echo "From: $ header [fromaddress]
";
Echo "To: $ header [toaddress]
";
Echo "Date: $ header [Date]
";
Echo "Subject: $ header [Subject]
";
Echo imap_body ($ link, $ num );
?>
View. php3 open the IMAP connection, obtain the mail header information, and display
This is Only a small program that has been used up. you need to write it on your own!
Else // but if you really want to write WEBMAIL, you have to consider more than that ...... Lone Wolf login. php3? Php if (! $ PHP_AUTH_USER) {Heade...