PHP code example of rezouce / mailcatcher
1. Go to this page and download the library: Download rezouce/mailcatcher library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rezouce / mailcatcher example snippets
use MailCatcher\MailCatcher;
use MailCatcher\MailCatcherAdapter;
use Guzzle\Http\Client;
$urlToMailCatcher = 'http://127.0.0.1:1080';
$adapter = new MailCatcherAdapter(new Client, $urlToMailCatcher);
$mailCatcher = new MailCatcher($adapter);
$mailCatcher->removeMessages(); // Delete all messages
$messages = $mailCatcher->messages(); // Get all messages in a traversable collection
// You can filter messages.
$sender = '[email protected]';
$messages->filter(function(Mail $message) use ($sender) {
return $message->sender() === $sender;
});