func (m *MailgunMail) RegisterRoute(i burner.Inbox) (string, error) {
	routeAddr := m.websiteAddr + "/mg/incoming/" + i.ID + "/"
	route, err := m.mg.CreateRoute(mailgun.Route{
		Priority:    1,
		Description: strconv.Itoa(int(i.TTL)),
		Expression:  "match_recipient(\"" + i.Address + "\")",
		Actions:     []string{"forward(\"" + routeAddr + "\")", "store()", "stop()"},
	})
	return route.ID, fmt.Errorf("Mailgun - failed to create route: %w", err)
}
RegisterRoute implements RegisterRoute()
package mailgunmail
import (
	"fmt"
	"net/http"
	"net/mail"
	"strconv"
	"time"
	"github.com/google/uuid"
	"github.com/gorilla/mux"
	"github.com/haydenwoodhead/burner.kiwi/burner"
	"github.com/haydenwoodhead/burner.kiwi/email"
	log "github.com/sirupsen/logrus"
	mailgun "gopkg.in/mailgun/mailgun-go.v1"
)
var _ burner.EmailProvider = &MailgunMail{}
type mailgunAPI interface {
	DeleteRoute(id string) error
	GetRoutes(limit, skip int) (int, []mailgun.Route, error)
	CreateRoute(m mailgun.Route) (mailgun.Route, error)
	VerifyWebhookRequest(req *http.Request) (verified bool, err error)
}
type MailgunMail struct {
	websiteAddr         string
	mg                  mailgunAPI
	db                  burner.Database
	isBlacklistedDomain func(string) bool
}
func NewMailProvider(domain string, key string) *MailgunMail {
	return &MailgunMail{
		mg: mailgun.NewMailgun(domain, key, ""),
	}
}
func (m *MailgunMail) Start(websiteAddr string, db burner.Database, r *mux.Router, isBlacklistedDomain func(string) bool) error {
	m.db = db
	m.isBlacklistedDomain = isBlacklistedDomain
	m.websiteAddr = websiteAddr
	r.HandleFunc("/mg/incoming/{inboxID}/", m.mailgunIncoming).Methods(http.MethodPost)
	go func() {
		for {
			log.Info("Mailgun: deleting expired routes")
			err := m.deleteExpiredRoutes()
			if err != nil {
				log.WithError(err).Error("Mailgun: failed to delete expired routes")
			}
			log.Info("Mailgun: deleted expired routes")
			time.Sleep(1 * time.Hour)
		}
	}()
	return nil
}
func (m *MailgunMail) Stop() error {
	return nil
}