• PHP Video Tutorials

PHP - IMAP Functions


Advertisements

IMAP stands for Internet Mail Access Protocol, PHP-IMAP functions helps you to access an email account and fetch emails from them. Using these functions you can also work with NNTP, POP3 protocols and local mailbox access methods. With the help of this library you can create web applications that handle your emails. Using this you can −

  • Connect to mailbox (POP3/IMAP/NNTP).

  • Retrieve e-mails with attachments.

  • Mark an email seen or unseen.

  • Remove emails etc...

Installation

To install IMAP in your system open php.ini file in your PHP installation folder and remove the semi colon (;) before the extension=imap (and other dependent extensions). Make sure you have installed a HTTP server software (like Apache 24), configure the installed server accordingly i.e. specify the location of the PHP installation folder, load the php7apache2_4.dll file module and, add the desired file types (extensions).

List of Functions

Following are various IMAP function that are available −

Sr.No Function & Description PHP
1

imap_8bit

This function converts an 8bit string to a quoted-printable string.

4
2

imap_alerts

This function returns all the alert messages from starting of the page or, the last call of this function, in the form of an array.

4
3

imap_append

This function appends the given message to the specified mailbox.

4
4

imap_base64

This function accepts a BASE64 encodex text as a parameter and decodes it.

4
5

imap_binary

This function converts an 8bit string to a base64 string.

4
6

imap_body

This function accepts an IMAP stream representing a mail box and a message number, fetches the specified message from the given mail box.

4
7

imap_bodystruct

This function is used to read the structure of a specified body section.

4
8

imap_check

This function returns information about the given mail box.

4
9

imap_clearflag_full

This function is used to remove flags on the specified messages in the given mailbox.

4
10

imap_close

This function is used to close the current mailbox.

4
11

imap_create

This function is used to create a new mailbox.

4
12

imap_createmailbox

This function is used to create a new mailbox.

4
13

imap_delete

This function is used to mark messages/mails for deletion.

4
14

imap_deletemailbox

This function is used to delete an existing mailbox.

4
15

imap_errors

This function retrieves and returns all the errors occurred in the current page.

4
16

imap_expunge

This function deletes all the messages that are marked for deletion.

4
17

imap_fetch_overview

This function retrives and returns the overview of the header info, of the specified method.

4
18

imap_fetchbody

This function is used to retrieve the specified section of the body of a mail/message.

4
19

imap_fetchheader

This function retrieves and returns the header of the specified mail/message in the current mailbox.

4
20

imap_fetchmime

This function retrieves and returns the MIME headers of the specified section of a message.

4
21

imap_fetchstructure

This function retrieves and returns the structure of the specified message in the current mailbox.

4
22

imap_fetchtext

This function fetches the specified message from the given mail box.

4
23

imap_gc

This function is used to clear the cache of the given mailbox.

5
24

imap_get_quota

This function is used to retrieve the quota level settings, and usage statics of the specified mailbox.

4
25

imap_get_quotaroot

This function is used to retrieve the quota level settings per user.

4
26

imap_getmailboxes

This function is used to retrieve the information on the mailboxes.

4
27

imap_getsubscribed

This function is used to retrieve information about all the subscribed mailboxes.

4
28

imap_header

This function is used to read the header of the specified message.

4
29

imap_headerinfo

This function is used to read the header of the specified message.

4
30

imap_headers

This function is used to retrieve the headers for all the messages in the specified mailbox.

4
31

imap_last_error

This function retrives and returns the last occurred error message.

4
32

imap_list

This function reads and returns the list of specified mailboxes.

4
33

imap_listmailbox

This function is an alias of imap_list(), it reads and returns the list of specified mailboxes.

4
34

imap_listscan

This function is used to retrieve names of the mailboxes containing the given text.

4
35

imap_listsubscribed

This function is an alias of imap_lsub(). It retrieves the headers for all the messages in the specified mailbox.

4
36

imap_lsub

This function is used to retrieve the headers for all the messages in the specified mailbox.

4
37

imap_mail_compose

This function creates a MIME message based on the details.

4
38

imap_mail_copy

This function copies the specified messages to the given mailbox.

4
39

imap_mail_move

This function moves the specified messages to the given mailbox.

4
40

imap_mail

This function is used to send the given message.

4
41

imap_mailboxmsginfo

This function retrieves and returns the information about the current mailbox.

4
42

imap_mime_header_decode

This function is used top decode the given MIME header.

4
43

imap_msgno

This function retrieves and returns the sequence number of the given UID.

4
44

imap_mutf7_to_utf8

This function is used to retrieve decodes the given string into UTF-8 format.

4
45

imap_num_msg

This function is used to retrieve the number of the messages in the specified mailbox.

4
46

imap_num_recent

This function is used to retrieve the number of recent messages in the specified mailbox.

4
47

imap_open

This function opens stream to the specified mailbox.

4
48

imap_ping

This function is used to verify whether the given stream is still active.

4
49

imap_qprint

This function returns an 8-bitstring for the quoted-printable string.

4
50

imap_rename

This function is an alias of imap_renamemailbox(). It is used to rename an existing mailbox.

4
51

imap_renamemailbox

This function is used to rename an existing mailbox.

4
52

imap_reopen

This function is used reopen the given stream to a new mailbox.

4
53

imap_rfc822_parse_adrlist

This function is used to parse an address string.

4
54

imap_rfc822_parse_headers

This function is used to parse and returns headers from the given string.

4
55

imap_rfc822_write_address

This function returns the formatted email address for the given details.

4
56

imap_savebody

This function saves the body of the given mail in the specified file path.

4
57

imap_scan

This function searches the mailboxes for the given text and returns the mathched messages.

4
58

imap_scanmailbox

This function searches the mailboxes for the given text and returns the matched messages.

4
59

imap_search

This function searches the mailbox and returns the matched messages in the form of an array.

4
60

imap_set_quota

This function sets the specified quota for the given mailbox.

4
61

imap_setflag_full

This function sets the specified flags on the given messages.

4
62

imap_sort

This function retrieves the messages in the given mailbox in the specified sorted order.

4
63

imap_status

This function retrieves and returns the status of the given mailbox.

4
64

imap_subscribe

This function is used to subscribe to a new mailbox.

4
65

imap_timeout

This function is used to set/fetch the time out value.

4
66

imap_uid

This function is used to retrieve the UID for the given message.

4
67

imap_undelete

This function is used to unmark all the messages that are marked for deletion in the specified mailbox.

4
68

imap_unsubscribe

This function is used to unsubscribe from the given mailbox.

4
69

imap_utf7_decode

This function is used to decode an UTF-7 string to ISO-8859-1 format.

4
70

imap_utf7_encode

This function is used to encode an ISO-8859-1 string to an UTF-7 string.

4
71

imap_utf8_to_mutf7

This function is used to encode the UTF-8 string to UTF-7 string.

4
72

imap_utf8

This function is used to decode the MIME encoding string into simple UTF-8 string.

4
php_function_reference.htm

Useful Video Courses


Video

PHP Online Training

45 Lectures 9 hours

Malhar Lathkar

Video

Become PHP Facebook Developer: Password-Less Authentication

34 Lectures 4 hours

Syed Raza

Video

Ultimate PHP & MySQL Web Development Course & OOP Coding

84 Lectures 5.5 hours

Frahaan Hussain

Video

Learn PHP from Scratch

17 Lectures 1 hours

Nivedita Jain

Video

E Commerce Website Development In PHP With PDO

100 Lectures 34 hours

Azaz Patel

Video

PHP in Telugu

43 Lectures 5.5 hours

Vijay Kumar Parvatha Reddy

Advertisements