PHPackages                             netandreus/imap-sync - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. netandreus/imap-sync

ActiveLibrary[Database &amp; ORM](/categories/database)

netandreus/imap-sync
====================

IMAP ➝ SQL syncing engine

v0.0.1(6y ago)332[8 PRs](https://github.com/netandreus/imap-sync/pulls)MITPHPPHP &gt;=7.0

Since Mar 24Pushed 3y ago1 watchersCompare

[ Source](https://github.com/netandreus/imap-sync)[ Packagist](https://packagist.org/packages/netandreus/imap-sync)[ Docs](https://github.com/netandreus/libremail/tree/packagist/sync)[ RSS](/packages/netandreus-imap-sync/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (21)Versions (10)Used By (0)

IMAP Sync
=========

[](#imap-sync)

This application synchronises IMAP accounts to a local MySQL database. You can use this as a standalone method to periodically download your email. The script is meant to run forever with almost zero maintenance :D

#### Web Client Admin Interface

[](#web-client-admin-interface)

[![Sync Web Screenshot](https://camo.githubusercontent.com/7d2fa8abd72b6ad1e3fd81b8c05522bb1ff13f4668a7d3a002cc7c9fa1e33ae2/687474703a2f2f6d696b6567696f69612e6769746875622e696f2f6c696272656d61696c2f696d616765732f73796e635f7765625f73637265656e73686f742e706e67)](https://camo.githubusercontent.com/7d2fa8abd72b6ad1e3fd81b8c05522bb1ff13f4668a7d3a002cc7c9fa1e33ae2/687474703a2f2f6d696b6567696f69612e6769746875622e696f2f6c696272656d61696c2f696d616765732f73796e635f7765625f73637265656e73686f742e706e67)

#### Command Line Interface

[](#command-line-interface)

[![Sync Screenshot](https://camo.githubusercontent.com/d07c5bcadfc992fa337853d3fc17e1b9a092b627bb1624ccda1ad865c4c01297/687474703a2f2f6d696b6567696f69612e6769746875622e696f2f6c696272656d61696c2f696d616765732f73796e635f73637265656e73686f742e706e67)](https://camo.githubusercontent.com/d07c5bcadfc992fa337853d3fc17e1b9a092b627bb1624ccda1ad865c4c01297/687474703a2f2f6d696b6567696f69612e6769746875622e696f2f6c696272656d61696c2f696d616765732f73796e635f73637265656e73686f742e706e67)

---

Contents
--------

[](#contents)

- [Dependencies](https://github.com/mikegioia/libremail/tree/master/sync#dependencies)
    1. [Support for PHP 5.6](https://github.com/mikegioia/libremail/tree/master/sync#1-support-for-php-56)
- [Installation](https://github.com/mikegioia/libremail/tree/master/sync#installation)
    1. [Create Database](https://github.com/mikegioia/libremail/tree/master/sync#1-create-database)
    2. [Configure the Application](https://github.com/mikegioia/libremail/tree/master/sync#2-configure-the-application)
    3. [Install Composer Dependencies](https://github.com/mikegioia/libremail/tree/master/sync#3-install-composer-dependencies)
    4. [Running the Diagnostic Tests](https://github.com/mikegioia/libremail/tree/master/sync#4-running-the-diagnostic-tests)
    5. [Running SQL Migration Scripts](https://github.com/mikegioia/libremail/tree/master/sync#5-running-sql-migration-scripts)
- [Run the IMAP Sync](https://github.com/mikegioia/libremail/tree/master/sync#run-the-sync)
- [Using an Init Script or Supervisor](https://github.com/mikegioia/libremail/tree/master/sync#using-an-init-script-or-supervisor)
- [Submitting Bugs](https://github.com/mikegioia/libremail/tree/master/sync#submitting-bugs)

Dependencies
------------

[](#dependencies)

At a glance, this application requires the following:

- PHP 7.0 or newer
- MySQL / MariaDB 10.0 or newer
- `ext-pdo`, `ext-iconv`, and `ext-mbstring`

It's recommented to install `ext-mysqlnd` as well. `php7.0-common` should already be installed on your system.

Versions 7.1 and 7.2 are confirmed working, and this codebase is actively developed in version 7.2. See below for info about PHP 5.6.

### 1. Support for PHP 5.6

[](#1-support-for-php-56)

Version 1.0.0 of this application supports PHP 5.6, with compatibility for all of the composer dependencies at that snapshot.

If you'd like to use that, run the following command:

```
$> git checkout 1.0.0

```

All current and future updates will only support PHP 7.0 and higher!

Installation
------------

[](#installation)

### 1. Create Database

[](#1-create-database)

To get started, make sure you have MariaDB or MySQL running and issue the following command:

```
MariaDB [(none)]> CREATE DATABASE `libremail`;

```

The database name is a configuration option, so if you'd like to change this to be something other than `libremail`, make sure you [update the config setting](https://github.com/mikegioia/libremail/tree/master/sync/doc/configuration.md#sql).

#### 1.1 `max_allowed_packet` (MariaDB/MySQL)

[](#11-max_allowed_packet-mariadbmysql)

Because of the amount of data that may be written to SQL (long email message text) a configuration setting needs to be enabled for MySQL databases allowing a larger packet size to be sent in a query. To do this, add the following line to your SQL config file:

```
[mysqld]
max_allowed_packet = 512M

```

You don't have to use 512MB as your packet size, but anything 16MB or higher is advised.

### 2. Configure the Application

[](#2-configure-the-application)

Configuration options are saved in `config/default.ini`. Do not modify this file or anything in it. **All of your changes should go into `config/local.ini`** and should be in the [INI file format](https://en.wikipedia.org/wiki/INI_file), just like the default file. If you would like to make changes to `config/local.ini`but not ever commit them, run the following:

```
$> git update-index --assume-unchanged config/local.ini

```

View all possible configuration options: [Configuration Options](https://github.com/mikegioia/libremail/tree/master/sync/doc/configuration.md#configuration-options)

### 3. Install Composer Dependencies

[](#3-install-composer-dependencies)

Download the vendor packages via [Composer](https://getcomposer.org):

```
$> composer install

```

This will create a `vendor` directory with all of the project's PHP dependencies.

### 4. Running the Diagnostic Tests

[](#4-running-the-diagnostic-tests)

You can run a test to see if the application is installed correctly, and that all dependencies and pre-requisites are met. To do that, run:

```
$> ./sync --diagnostics

```

You can also use `-d` as a short flag. This will go through and check the database connection, that all paths are writeable, and some other tests and see if the sync script will run correctly. These tests are run in the background before any sync happens, but you can access them this way for more detailed information in the case that something is failing.

### 5. Running SQL Migration Scripts

[](#5-running-sql-migration-scripts)

Before you can start syncing, run the SQL database scripts:

```
$> ./sync --updatedb

```

You can also use `-u` as a short flag. This will create all the SQL tables and run any other database operations.

Run the Sync
------------

[](#run-the-sync)

If you'd like, you can run `./sync --help` to see a list of what options you have. View all possible configuration options and their details: [Configuration Options](https://github.com/mikegioia/libremail/tree/master/sync/doc/sync-options.md#sync-options)

To use the **CLI** tool (debug mode), run:

```
$> ./sync

```

and follow the onscreen instructions.

To use the **Web** tool, run:

```
$> ./libremail

```

This tool will run silently and write to `/logs`. Open your browser and go to [localhost:9898](http://localhost:9898) to view the Web client.

Using an Init Script or Supervisor
----------------------------------

[](#using-an-init-script-or-supervisor)

If you'd like to run this sync script in the background all the time, then it is recommended to use some sort of supervisor or watchdog program to monitor if the script fails for any reason. Here are some guides for Linux and MacOS:

- [SystemD](https://github.com/mikegioia/libremail/tree/master/sync/doc/systemd.md#systemd)
- [SysV Init](https://github.com/mikegioia/libremail/tree/master/sync/doc/sysv-init.md#sysv-init)
- [MacOS LaunchD](https://github.com/mikegioia/libremail/tree/master/sync/doc/macos-launchd.md#macos-launchd)

Submitting Bugs
---------------

[](#submitting-bugs)

All bugs and requests are tracked in the Github Issues for this repository. See the [Issues Page](https://github.com/mikegioia/libremail/issues) for a listing of the open and closed tickets. **Please search the closed issues before reporting anything** to see if it has been resolved :)

This is an open source project that is worked on in spare time, so there is no guarantee that anything that you report will be looked at or fixed! However I will make a personal effort to resolve everything in a timely manner, and odds are good that I'll check it out quickly as I'm personally using this project to manage my own email.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2243d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fc432ddf75df0cdc43bfd71385db03c0743d77a67cb801e591998302ccc6a67c?d=identicon)[netandreus](/maintainers/netandreus)

---

Top Contributors

[![netandreus](https://avatars.githubusercontent.com/u/313477?v=4)](https://github.com/netandreus "netandreus (9 commits)")

### Embed Badge

![Health badge](/badges/netandreus-imap-sync/health.svg)

```
[![Health](https://phpackages.com/badges/netandreus-imap-sync/health.svg)](https://phpackages.com/packages/netandreus-imap-sync)
```

###  Alternatives

[getgrav/grav

Modern, Crazy Fast, Ridiculously Easy and Amazingly Powerful Flat-File CMS

15.4k84.1k1](/packages/getgrav-grav)[team-reflex/discord-php

An unofficial API to interact with the voice and text service Discord.

1.1k379.4k24](/packages/team-reflex-discord-php)[damienharper/auditor-bundle

Integrate auditor library in your Symfony projects.

4542.8M](/packages/damienharper-auditor-bundle)[react/mysql

Async MySQL database client for ReactPHP.

340421.0k29](/packages/react-mysql)[bolt/core

🧿 Bolt Core

585142.5k54](/packages/bolt-core)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

7310.3k29](/packages/open-dxp-opendxp)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
