ch0c4 / cake-mailer
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
Requires
- php: >=5.4.16
- cakephp/cakephp: ~3.0
Requires (Dev)
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