ATTENTION! Work in progress, no working release yet!
Email2DB parses the email schema into the relational schema.
We assume the Ubuntu 12.04 and later here on.
Install IMAP extension
sudo apt-get install php5-imap
Enable IMAP extensions (creates symlink in /etc/php5/cli/conf.d/
)
sudo php5enmod imap
Mailparse installation
sudo apt-get install php5-dev
Compiling mailparse
sudo pecl install mailparse
And enabling it
echo "extension=mailparse.so" > /etc/php5/mods-available/mailparse.ini
sudo php5enmod mailparse
Install composer
curl -sS https://getcomposer.org/installer | php
For MySQL configuration on Ubuntu older 14.04
sudo apt-get install php5-mysqlnd
and find the pdo_mysql
module in the running config, the essential to Doctrine
$ php -m| grep -i mysql
mysql
mysqli
mysqlnd
pdo_mysql
Next install all necessary packages
./composer.phar install
No errors should be in the output, if there appear some, please check the previous step.
Now check out the configuration
$ ./composer.phar show -p | grep -E "imap|mail"
ext-imap 0 The imap PHP extension
ext-mailparse 2.1.6 The mailparse PHP extension
ext-mysql 1.0 The mysql PHP extension
ext-mysqli 0.1 The mysqli PHP extension
ext-mysqlnd 0 The mysqlnd PHP extension
ext-pdo_mysql 1.0.2 The pdo_mysql PHP extension
$ vendor/bin/doctrine orm:schema-tool:create
ATTENTION: This operation should not be executed in a production environment.
Creating database schema...
Database schema created successfully!
Here we describe our decision on dependences
cat composer.json
...
"require": {
"php": ">=5.3.0",
"phing/phing" : "2.*",
"pear-pear.php.net/pear": "*",
"pear/System_Daemon": "*@dev",
"pear/pear_exception": "*@beta",
"pear/Log": "*",
"exorus/php-mime-mail-parser": "dev-master",
"doctrine/orm": "*",
"ext-imap": "*"
},
...
For the database interaction we choose Doctrine, we find it to be the most reliable and the most flexible version of open ORM. It can intercat with variety of RDBMS and NoSQL databases and can exploit tailable capabilities of some databases like MongoDB.
The PEAR :: System Daemon library is used to run Email2DB as a daemon in background.
PECL :: Mailparse is an extension for parsing and working with email messages. It can deal with RFC822 and RFC2045 (MIME) compliant messages.
PHP :: IMAP is the most comprehensive PHP library to operate with the IMAP protocol, as well as the NNTP, POP3 and local mailbox.
PHP Mime Mail Parser is used to parse the Mime messages in the version maintained by @eXorus.
Please clone, star and pull request. Please follow the PSR coding style.