PHPackages                             3xw/cakephp-mailparser - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. 3xw/cakephp-mailparser

ActiveCakephp-plugin[HTTP &amp; Networking](/categories/http)

3xw/cakephp-mailparser
======================

CakePHP mail parser

3.4.0.3(8y ago)043MITPHPPHP &gt;=5.6

Since Jul 5Pushed 5y ago1 watchersCompare

[ Source](https://github.com/3xw/cakephp-mailparser)[ Packagist](https://packagist.org/packages/3xw/cakephp-mailparser)[ RSS](/packages/3xw-cakephp-mailparser/feed)WikiDiscussions master Synced today

READMEChangelog (4)Dependencies (6)Versions (5)Used By (0)

cakephp-parser plugin for CakePHP
=================================

[](#cakephp-parser-plugin-for-cakephp)

 [ ![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265) ](LICENSE.md)

Use this plugin to connect a mail account retrieve mail(s) &amp; related attachment(s). A base Parser class is present in order to parse csv/xls files and store data in your db via your models. this plugin comes with very usefull libs:

```
"dereuromark/cakephp-queue": "^3.4",
"php-imap/php-imap": "~2.0",
"league/csv": "^8.2",
"phpoffice/phpexcel": "^1.8"

```

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

[](#installation)

You can install this plugin into your CakePHP application using [composer](http://getcomposer.org).

The recommended way to install composer packages is:

```
composer require 3xw/cakephp-mailparser

```

Load it in your config/boostrap.php

```
not needed

```

Workers
-------

[](#workers)

### SaveMailAttachments queue task

[](#savemailattachments-queue-task)

based on [dereuromark/cakephp-queue](https://github.com/dereuromark/cakephp-queue) you can directly use the SaveMailAttachments task. You can add the task to workers list:

```
$this->QueuedJobs->createJob('SaveMailAttachments', [
	'name' => 'Save mail attachments',
	'data' => [
		'username' => 'username',
		'password' => 'password',
		'mailbox' => '{imap.example.org:993/imap/ssl}INBOX',
		'mailObjectNeedles' => ['test','exemple'], 	// mail objects array to look for
		'fileNeedles' => ['.*\.xlsx'], 				// file serach strings array based on cakephp's Folder::find() fct
		'folder' => TMP.'MailAttachments/' 			// folder to copy files in. ( be sure folder exists if php is not allowed to create the very folder )
	]
]);

```

### Extends the SaveMailAttachments queue task

[](#extends-the-savemailattachments-queue-task)

Find here a exemple task that extends SaveMailAttachments Task:

```
