laravelgmailgoogle-workspacemailing

How to send mails using laravel with google workspace


I want to send mails using google workspace, like the wordpress SMTP mailer functionality, u create a app in google admin console and give the client_id and client_secret and then authenticate the app and thats it, all the emails are now sent via google workspace, how to do this for laravel?

i found many solutions like apppassword or username and password (not supported for long anymore) and google advises to use Oauth. i already have the authentication via laravel Socialite, now i have the access token but i dont know what to do next? anyone that can help me, or suggestions?


Solution

  • There are a few options depending on how many messages you think you'll need to send. All of them require configuring the mail related environment variables as described in the Laravel documentation.

    This article from Google's support knowledge base may be helpful in deciding what option you wish to use.