MapyWeb/email.go

52 lines
1.1 KiB
Go

package main
import (
"io/ioutil"
"net/http"
"github.com/matcornic/hermes/v2"
)
func EmailTest(w http.ResponseWriter, r *http.Request) {
h := hermes.Hermes{
Product: hermes.Product{
Name: "MapyWeb",
Link: "https://smoqueed.com/",
Logo: "https://tcp.direct/maplestory.png",
},
}
email := hermes.Email{
Body: hermes.Body{
Name: "MapyBoi",
Intros: []string{
"Welcome to Mapy!",
},
Actions: []hermes.Action{
{
Instructions: "To get started, please click here:",
Button: hermes.Button{
Color: "#22BC66", // Optional action button color
Text: "Confirm your account",
Link: "https://smoqueed.com/confirm?token=d9729feb74992cc3482b350163a1a010",
},
},
},
Outros: []string{
"Need help, or have questions? Join our discord! https://discord.gg/something",
},
},
}
emailBody, err := h.GenerateHTML(email)
if err != nil {
panic(err) // Tip: Handle error with something else than a panic ;)
}
err = ioutil.WriteFile("preview.html", []byte(emailBody), 0644)
if err != nil {
panic(err) // Tip: Handle error with something else than a panic ;)
}
}