https://github.com/litongjava/open-microservice-api
https://github.com/litongjava/open-microservice-api
Last synced: 14 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/litongjava/open-microservice-api
- Owner: litongjava
- License: apache-2.0
- Created: 2023-07-22T23:02:33.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-07-22T23:18:35.000Z (almost 3 years ago)
- Last Synced: 2025-01-26T04:09:33.125Z (over 1 year ago)
- Language: Go
- Size: 126 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# open-microservice-api
1. send mail via google mail
## Install
set environment
```
PORT=8080;MAIL_USER=;MAIL_PASSWORD=
```
MAIL_USER is your google acount,MAIL_PASSWORD is your google account's app password
## Get Google Account App Password
[https://myaccount.google.com/security](https://myaccount.google.com/security)
turn on 2-Step Verification

App password

geneate app password


## send mail
### curl
```
curl --location --request POST 'https://localhost:8080' \
--header 'User-Agent: apifox/1.0.0 (https://www.apifox.cn)' \
--header 'Content-Type: application/json' \
--data-raw '{
"to": "to",
"subject": "sbuject",
"body": "body"
}'
```
### pytyon requests
````
import requests
import json
url = "https://localhost:8080"
payload = json.dumps({
"to": "litong@hawaii.edu",
"subject": "王志安 更新",
"body": "王志安有更新了信息,请访问下面的地址查看."
})
headers = {
'User-Agent': 'apifox/1.0.0 (https://www.apifox.cn)',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
```