This is a simple Node.js application that uses Google's Gmail API to send emails. The application is built with Express.js and uses OAuth2 for authentication.
To get started with this project, clone the repository and install the dependencies:
git clone [email protected]:md-abdul-halim-rafi/gmail-app.git
cd gmail-app
npm install
Create a .env
file and copy variables from .env.example
file and replace your values:
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
REDIRECT_URI=
You can run the application using the following command:
npm run dev
This will start the server on port 3000.
The application provides two main routes:
- `/auth/login``: This route redirects the user to Google's OAuth2 consent screen.
- `/auth/callback``: This route handles the OAuth2 callback and retrieves the access and refresh tokens.
Once authenticated, you can use the /email/send
POST route to send an email. This route requires the access and refresh tokens obtained from the OAuth2 process.
This is a fun project and should not be used for sending spam or unsolicited emails. Always respect the privacy and rights of others when sending emails.
Contributions are welcome. Please feel free to submit a pull request or open an issue.
This project is licensed under the ISC License.