ch0c4/cake-mailer

There is no license information available for the latest version (dev-master) of this package.

CakeMailer plugin for CakePHP

Installs: 1 429

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

Type:cakephp-plugin

dev-master 2015-11-12 07:40 UTC

This package is not auto-updated.

Last update: 2020-11-13 21:29:19 UTC


README

Installation

You can install this plugin into your CakePHP application using composer.

The recommended way to install composer packages is:

composer require ch0c4/cake-mailer

Before you can do any request you need set information :

// in config/app.php
    'imap_gmail' => [
        'className' => 'CakeMailer\Datasource\Connection',
        'server' => 'imap.gmail.com',
        'username' => 'xxxxxxx@gmail.com',
        'password' => 'xxxxx',
        'port' => 993,
        'type' => 'imap',
        'ssl' => true,
        'encoding' => 'utf8',
    ],

Usage

// in your controller
use Cake\Datasource\ConnectionManager;

class MyController extends AppController {
	
	public function index() {

		$conn = ConnectionManager::get('imap_gmail');
        $conn->connect();
        $mailsId = $conn->searchMailbox();
		
		$mails = [];
        foreach ($mailsId as $mailId) {
            $mails[] = $conn->getMail($mailId);
        }

        debug($mails); // see your email

	}

}

Watch source Datasource/Connection.php for other infos