21

GitHub - BarryYan/daily-warm: ❤️Send an email to someone you care about everyday

 4 years ago
source link: https://github.com/BarryYan/daily-warm
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md

Daily-warm

每天定时发邮件给你关心的人, 内容包含天气, one 的一句话, 一句英语, 一首古诗

Usage

# 1. Config `.env` file in root dir, e.g.
MAIL_USERNAME = [email protected]
MAIL_PASSWORD = ***********
MAIL_HOST = smtp.qq.com
MAIL_PORT = 25
# 每分钟发一次
MAIL_CRON = "0/1 * * * *"
MAIL_SUBJECT = 每日一暖, 温情一生
MAIL_FROM = user<[email protected]>
MAIL_TO = [{"email": "user<[email protected]>", "local": "shaanxi/xian"}]

# 2.Build
go mod download
go build -o dwm.out *.go

# 3. Run
./dwm.out

Screenshot

screenshot.jpg?raw=true

Package

github.com/barryyan/daily-warm/gomail

// import "github.com/barryyan/daily-warm/gomail"
package gomail 

type Configuration struct{
  Host     string
  Port     uint16
  Username string
  Password string
  From     string
}
var Config = Configuration{}

type GoMail struct{
  From    string
  To      []string
  Cc      []string
  Bcc     []string
  Subject string
  Content string
}
func (gm *GoMail) Send() error {}

github.com/barryyan/daily-warm/api

// import "github.com/barryyan/daily-warm/api"
package api 

func CreateClient() *http.Client
func Fetch(url string) io.Reader
func FetchHTML(url string) *query.Document
type English struct{
  ImgURL   string
  Sentence string
}
func GetEnglish() English
type One struct{
  Date     string
  ImgURL   string
  Sentence string
}
func GetONE() One
type Poem struct{
  Title   string   `json:"title"`
  Dynasty string   `json:"dynasty"`
  Author  string   `json:"author"`
  Content []string `json:"content"`
}
func GetPoem() Poem
type PoemRes struct{
  Status string `json:"status"`
  Data   struct {
    Origin Poem `json:"origin"`
  } `json:"data"`
}
type Weather struct{
  City     string
  Temp     string
  Weather  string
  Air      string
  Humidity string
  Wind     string
  Limit    string
  Note     string
}
func GetWeather(local string) Weather

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK