Skip to content

Instantly share code, notes, and snippets.

@monaye
Created April 14, 2020 22:43
Show Gist options
  • Select an option

  • Save monaye/4da581e1ea8d583cee8d17f571f65dc5 to your computer and use it in GitHub Desktop.

Select an option

Save monaye/4da581e1ea8d583cee8d17f571f65dc5 to your computer and use it in GitHub Desktop.
[Guzzule Mailhog Code Sample] #laravel #mailhog
$mailhog = new \GuzzleHttp\Client([
'base_uri' => 'http://127.0.0.1:8025'
]);
$emails = json_decode(
$mailhog
->get('/api/v1/messages')
->getBody()
->getContents()
);
$emailId = end($emails)->ID;
$lastEmail = json_decode(
$mailhog
->get("/api/v1/messages/{$emailId}")
->getBody()
->getContents()
);
dd($lastEmail->Content->Headers->To[0]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment