2021-12-16 04:11:33 +00:00
|
|
|
# Kumoly App
|
|
|
|
|
2021-12-16 11:44:07 +00:00
|
|
|
combine all needed module into one lib
|
|
|
|
|
|
|
|
## Run
|
|
|
|
|
|
|
|
```
|
|
|
|
|
2021-12-17 04:54:03 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Email
|
|
|
|
|
|
|
|
```go
|
|
|
|
m := gomail.NewMessage()
|
|
|
|
m.SetHeader("From", "from@example.com")
|
|
|
|
m.SetHeader("To", "to@example.com")
|
|
|
|
m.SetHeader("Subject", "Hello!")
|
|
|
|
m.SetBody("text/plain", "Hello!")
|
|
|
|
|
|
|
|
s := gomail.SendFunc(func(from string, to []string, msg io.WriterTo) error {
|
|
|
|
// Implements you email-sending function, for example by calling
|
|
|
|
// an API, or running postfix, etc.
|
|
|
|
fmt.Println("From:", from)
|
|
|
|
fmt.Println("To:", to)
|
|
|
|
return nil
|
|
|
|
})
|
|
|
|
|
|
|
|
if err := gomail.Send(s, m); err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2021-12-16 11:44:07 +00:00
|
|
|
```
|