library mail-reader
Test emails easily
silverslice/mail-reader
Test emails easily
- Thursday, June 2, 2016
- by silverslice
- Repository
- 1 Watchers
- 0 Stars
- 8 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 2 Versions
- 0 % Grown
Test emails easily in php
, (*1)
Without mailcatcher headache:), (*2)
MailReader stores your emails in local directory and provides convenient way to test them., (*3)
Install
composer require silverslice/mail-reader, (*4)
Usage
- Copy
bin/smtp_catcher.php to convenient folder.
- Specify folder for e-mails in
bin/smtp_catcher.php (optional).
- Set in php.ini:
sendmail_path = /path/to/smtp_catcher.php
- Write test:
use Silverslice\MailReader\MailReader;
...
public function testGetLastMessage()
{
$reader = new MailReader('/path/to/mails/');
// get last sent message
$message = $reader->getLastMessage();
$this->assertEquals('fromemail@mail.dev', $message->getFrom());
$this->assertEquals('toemail@mail.dev', $message->getTo());
$this->assertEquals('Third email', $message->getSubject());
$this->assertContains('This is the last email', $message->getBody());
$this->assertTrue($message->hasAttachment());
$this->assertTrue($message->hasAttachmentWithName('file1.txt'));
// get total count of messages
$count = $reader->getCountOfMessages();
// get next to the last message
$prevMessage = $reader->getLastMessageByIndex(1);
// clear all messages
$reader->clearMessages();
}
dev-master
9999999-dev
Test emails easily
Sources
Download
MIT
The Requires
The Development Requires
by
Igor Mikheev
mail
test
email
v0.1.0
0.1.0.0
Test emails easily
Sources
Download
MIT
The Requires
The Development Requires
by
Igor Mikheev
mail
test
email