IMAP stands for Internet Message Access Protocol. It is an application layer protocol. PHP-IMAP is used to efficiently access messages from the IMAP server. IMAP stores email on the server and can download on-demand. To access the IMAP server we have to use PHP IMAP extension, now using this extension we can execute several operations to get different parts of the message. Or we can say that it acts as an intermediary between client and email servers. It was designed by Mark Crispin in 1986 as a remote access mailbox protocol. Some important features of IMAP are:
- Connects to the mailbox like POP3, IMAP, NNAP, etc.
- Returns mailbox information
- Read e-mails including attachments
- Save attachments from remote IMAP server locally.
- Also, mark emails are seen or unseen
Prerequisites:
- Install XAMPP.
- Verify if IMAP is already installed or not.
Verifying IMAP is installed or not
To verify the IMAP extension is installed or not you have to follow the following step:
Step 1: Create a new file in the root directory with an extension.php like findingexten.php. In this file write the following code:
<?php // It will return all the configurations of the server phpinfo(); ?>
Step 2: Run this file in any browser and you will see the IMAP is installed or not.
Installing imap extension in PHP on Windows
There are many ways to install an IMAP extension. Following is one of the ways of installing IMAP.
Step 1: Click on the Config button and open php.ini in your editor.
Step 2: Find “;extension=imap” in the file and remove the semicolon from it and then save the file.
Step 3: Go to php folder in your system. It is usually present in C:\xampp.
Step 4: Look for php_imap.dll in the ext folder.
Step 5: Copy php_imap.dll and paste it into the following folder.
C:\Windows\System32
Step 6: Now restart the XAMPP server to see the effects.