src/Mailtrap.php
public function fetchEmails()
  {
    $this->fetchedEmails = array();

    try
    {
      $response = $this->sendRequest('GET', "/api/v1/inboxes/{$this->config['inbox_id']}/messages");
      $this->fetchedEmails = json_decode($response->getBody());
    }
    catch(Exception $e)
    {
      $this->fail('Exception: ' . $e->getMessage());
    }

    $this->sortEmails($this->fetchedEmails);

    // by default, work on all emails
    $this->setCurrentInbox($this->fetchedEmails);
  }
public function fetchEmails()
  {
    $this->fetchedEmails = array();

    try
    {
      $response = $this->sendRequest('GET', "/api/v1/inboxes/{$this->config['inbox_id']}/messages");
      $this->fetchedEmails = json_decode($response->getBody());
    }
    catch(Exception $e)
    {
      $this->fail('Exception: ' . $e->getMessage());
    }

    $this->sortEmails($this->fetchedEmails);

    // by default, work on all emails
    $this->setCurrentInbox($this->fetchedEmails);
  }
public function fetchEmails ( ) { $ this -> fetchedEmails = array ( ) ; try { $ response = $ this -> sendRequest ( 'GET' , "/api/v1/inboxes/{$this->config['inbox_id']}/messages" ) ; $ this -> fetchedEmails = json_decode ( $ response -> getBody ( ) ) ; } catch ( Exception $ e ) { $ this -> fail ( 'Exception: ' . $ e -> getMessage ( ) ) ; } $ this -> sortEmails ( $ this -> fetchedEmails ) ; // by default, work on all emails $ this -> setCurrentInbox ( $ this -> fetchedEmails ) ; }
Fetch Emails

Accessible from tests, fetches all emails
Fetch Emails