Php Imap Fetcher

Open source PHP to fetch or pipe email from a POP box, save the message to MySQL, and save attachments/images locally.
Alternatives To Php Imap Fetcher
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
5 months ago7Python
Fake Protocol Server
Pop1,31977a month ago206August 10, 202197mitGo
A Tasty Treat For All Your Database Needs
Fizz131115898 months ago62July 09, 202221mitGo
A Common DSL for Migrating Databases
a day ago21gpl-3.0TypeScript
The most popular K-pop song guessing game on the internet, with over 600,000 games played and 100,000 unique players!
Postfixadmin Installer21
4 years ago14mitPerl
Script to install a Postfix/Dovecot/Mysql system and the postfixadmin web UI
2019 0620
3 years ago6mitJavaScript
📮 우리들의 이메일 서비스, 다잇누!
Php Imap Fetcher10
5 years ago3PHP
Open source PHP to fetch or pipe email from a POP box, save the message to MySQL, and save attachments/images locally.
20 days agootherPHP
Smart Framework - A High Performance PHP / Javascript Framework for Web Projects
4 years ago2PHP
Realm Pop shows you population statistics on the players' characters in World of Warcraft.
Docker Postfix2
4 days ago1mitShell
Docker image, Postfix (Dovecot) mail server: SMTP, IMAP, POP3, LDAP, MySQL. ENV configuration. Demo included.
Alternatives To Php Imap Fetcher
Select To Compare

Alternative Project Comparisons

PHP IMAP Fetcher

PHP IMAP Fetcher is an open source PHP script that can fetch or pipe emails from a POP box, save the message to MySQL (both text-plain and text-html), and save attachments/images locally.


The script has been tested on emails sent from Gmail, Outlook, Yahoo, Apple Mail, Mozilla Thunderbird, and others.


Navigate to the folder on your server where you want to run the script.

  1. Upload the files:
  • application.php
  • class.php
  • config.php
  • mimeDecode.php
  1. Create a folder called "files" and make sure it's writable by the web server.

  2. In your MySQL database, create the tables "emails" and "files" by importing the file:

  • mysql-structure.sql
  1. Open the file config.php and add your MySQL and POP credentials.

Pipe vs Fetch

You can either pipe an email address to the script to process each email as it arrives, or you can fetch emails one-by-one from a mailbox using a cron job (emails are deleted as they're processed.) We recommend using the fetch method.

The script is set to "fetch" by default but you can change it to "pipe" in config.php

IMAP Flags

There are flags set by default in config.php but you can change them by referencing:

Running the script

The file to either pipe to or run as a cron job is application.php

Referencing attachments/images

When an email is processed, a unique ID will be generated for the MySQL record and if any attachments are present, a folder for that ID will be created in your "files" folder. Attachments will be saved there.

Reference to images is only saved in the "text-html" part of the message, and not the "text-plain."

Images are referenced like:


When including the message in your own application you'll simply replace "[filePath]" with the relevant folder path, for example, if the path to your files is:


then your code will be

$str = str_replace("[filePath]","/application/files",$str);

Popular Mysql Projects
Popular Pop Projects
Popular Data Storage Categories

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.