How to download attachmen from email in php/ laravel socialite?

The project I’m working on would ideally scan every delivered email to "[email protected]" then forward every email to gmail. If there is attachment with particular extension it would be extracted and stored on my app’s server for further examination.

From my research I could use Google developer API https://developers.google.com/gmail/api/reference/rest/v1/users.messages.attachments/get#examples

With this official library https://github.com/googleapis/google-api-php-client

Or better with Laravel Socialite since I’m developing in Laravel https://laravel.com/docs/8.x/socialite

Is this the correct way to do it?

Source: Laravel

Leave a Reply