How to Send Email using Gmail API in PHP

preview_player
Показать описание
In this tutorial, we build a script that sends emails using Gmail API in PHP. It requires you to follow OAuth 2.0 and grab the access token. Then with the combination of Google email and access token email can be sent.

Register Google Application and Create Credentials.
2) Create a new project. You can also select an existing project.
3) Add a name to your project. Google Console will generate a unique Project ID for it.
4) Your project will appear on top of the left sidebar.
5) Click on Library. You will see a list of Google APIs.
6) Enable Gmail API.
7) Click on the Credentials. Select Oauth Client id under Create credentials. Choose the radio button for Web Application.
9) Click on the Create button. You will get a client ID and client secret in the pop-up. Copy these details. We will need it in a moment.

Рекомендации по теме
Комментарии
Автор

I've been looking it for so long 😂

hungoan
Автор

Thank you its working fine in local but after getting up in live its getting error.
and I changed all things accordingly like call back url and access type online.etc
its showing me http 500 error, but same code with localhost access working cool

azharislam
Автор

Good tutorial, but I'm running in a Problem "
Warning: Undefined variable $adapter in on line 36"
do you know how to solve it?

raffaelerienzi