You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
613 B
38 lines
613 B
package main
|
|
|
|
import (
|
|
"MY/webapp/config"
|
|
email "MY/webapp/common/email"
|
|
"context"
|
|
"fmt"
|
|
)
|
|
|
|
type Person struct {
|
|
Name string
|
|
Pet string
|
|
}
|
|
|
|
func main() {
|
|
config.Load("config.json")
|
|
|
|
ctx := context.Background()
|
|
|
|
msg := email.EmailMessage{
|
|
To: "tina.recip@example.com",
|
|
From: "toni.sender@example.com",
|
|
Subject: "This is my first mail.",
|
|
Template: "signup.md",
|
|
Data: Person{
|
|
Name: "Zed",
|
|
Pet: "None",
|
|
},
|
|
}
|
|
|
|
fmt.Println("sending", msg)
|
|
|
|
sender := email.NewSender(ctx)
|
|
defer sender.Close()
|
|
|
|
err := sender.QueueEmail(msg)
|
|
if err != nil { panic(err) }
|
|
}
|
|
|