PHP Classes

PHP IMAP Search: Find and save messages in IMAP server to database

Recommend this page to a friend!
  Info   View files Example   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 57%Total: 228 All time: 8,169 This week: 555Up
Version License PHP version Categories
base_imap 1.0GNU General Publi...5Email, PHP 5, Databases, Searching
Description 

Author

This class can find and save messages in IMAP server to database.

It can connect to a given IMAP server and access a given mailbox account.

The class can search for messages in the mailbox based on given criteria like ALL, ANSWERED, BCC, BEFORE, BODY, CC, DELETED, FLAGGED, FROM, KEYWORD, NEW, OLD, ON "date", RECENT, SEEN, SINCE, SUBJECT, TEXT "string", TO, UNANSWERED, UNDELETED, UNFLAGGED, UNKEYWORD "string" and UNSEEN.

The found messages can be saved to a MySQL database table using MySQLi.

Picture of Abhijit Jagtap
  Performance   Level  
Name: Abhijit Jagtap <contact>
Classes: 1 package by
Country: India India
Age: 30
All time rank: 4060276 in India India
Week rank: 4277 Down287 in India India Down

Example

<?php
ini_set
('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ERROR);
require_once
'src/imap.php';
/*
 * imap credentials goes here
 */
$authhost = "{xxxx.net:143/novalidate-cert}INBOX";
$email = "yyy@xxxx.net"; //dummy text. I swear i dont have typo here
$emailPassword = "zzzz"; //dummy text. No typo here.


$imap = new imap($authhost, $email, $emailPassword);
/*
 * if you want to save in db.
 */
$imap->save_into_db = FALSE; //default its TRUE
/*
 * if @save_into_db=TRUE then plz provide following details
 */
$imap->serverIP = "localhost";
$imap->userName = "****";
$imap->userPassword = "********";
$imap->databaseName = "db_name";

/*
 * get new mails
 */
$imap->search("UNSEEN");

/*
 * ooooh its done!
 */


  Files folder image Files  
File Role Description
Files folder imagesrc (1 file)
Accessible without login Plain text file example.php Example To find the unread emails when looping through look for the ->Unseen property like so:
Accessible without login Plain text file mails.sql Data sql file

  Files folder image Files  /  src  
File Role Description
  Plain text file imap.php Class class file

 Version Control Unique User Downloads Download Rankings  
 0%
Total:228
This week:0
All time:8,169
This week:555Up
 User Ratings  
 
 All time
Utility:83%StarStarStarStarStar
Consistency:83%StarStarStarStarStar
Documentation:-
Examples:75%StarStarStarStar
Tests:-
Videos:-
Overall:57%StarStarStar
Rank:1653