Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/binodkafle/gomail
Example go project to send email using GO via smtp, Gmail API and OAuth2. This is also a reference project for my article in medium titled "Sending Emails with GO (Golang) Using SMTP, Gmail, and OAuth2"
https://github.com/binodkafle/gomail
email gmailapi golang oauth2 smtp
Last synced: 3 months ago
JSON representation
Example go project to send email using GO via smtp, Gmail API and OAuth2. This is also a reference project for my article in medium titled "Sending Emails with GO (Golang) Using SMTP, Gmail, and OAuth2"
- Host: GitHub
- URL: https://github.com/binodkafle/gomail
- Owner: BinodKafle
- License: mit
- Created: 2020-08-18T15:53:16.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-08-03T15:03:49.000Z (over 3 years ago)
- Last Synced: 2024-10-02T09:11:59.432Z (4 months ago)
- Topics: email, gmailapi, golang, oauth2, smtp
- Language: Go
- Homepage: https://medium.com/wesionary-team/sending-emails-with-go-golang-using-smtp-gmail-and-oauth2-185ee12ab306
- Size: 33.2 KB
- Stars: 18
- Watchers: 2
- Forks: 17
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
## How to use this project
Clone the repo### Download project dependencies
```
go mod download
```### Setting up environment
- Copy `.env.example` file and paste it as `.env` in the same path
- In `.env` file Add your email and password and leave other values as it is
- Add your email address in `EMAIL_TO` in which you want to receive your test email
- For using OAUTH2 to send email and filling up environment variables `CLIENT_ID`, `CLIENT_SECRET`, `ACCESS_TOKEN` and `REFRESH_TOKEN` follow my medium article [Sending Emails with GO (Golang) Using SMTP, Gmail, and OAuth2](https://medium.com/wesionary-team/sending-emails-with-go-golang-using-smtp-gmail-and-oauth2-185ee12ab306)### Sending email
- For sending test email using SMTP, execute following command
```
go run main.go SMTP
```- For sending test email using Gmail API and OAUTH2, execute following command
```
go run main.go OAUTH
```NOTE: Environment variables must be filled properly to be able to execute above commands