Created
April 14, 2020 22:43
-
-
Save monaye/4da581e1ea8d583cee8d17f571f65dc5 to your computer and use it in GitHub Desktop.
[Guzzule Mailhog Code Sample] #laravel #mailhog
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $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