A small project that collects various nice things to get started with Go Web Development.
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.
|
|
|
|
package features_email
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
email "MY/webapp/common/email"
|
|
|
|
|
"github.com/gofiber/fiber/v2"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func PostApiEmailSend(c *fiber.Ctx) error {
|
|
|
|
|
go email.OneShotSend(email.EmailMessage{
|
|
|
|
|
To: c.FormValue("To"),
|
|
|
|
|
From: c.FormValue("From"),
|
|
|
|
|
Subject: c.FormValue("Subject"),
|
|
|
|
|
TextTemplate: c.FormValue("Template"),
|
|
|
|
|
HTMLTemplate: c.FormValue("Template"),
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
return c.Redirect("/email/")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func SetupApi(app *fiber.App) {
|
|
|
|
|
app.Post("/api/email/send", PostApiEmailSend)
|
|
|
|
|
}
|