Files
sxchnge/backend/notifications/email/resend.go

23 lines
668 B
Go

package email
import (
"context"
"net/mail"
"git.sendico.io/tech/sxchnge/notifications/model"
)
type resend struct{ client }
type resendRequest struct {
From string `json:"from"`
To []string `json:"to"`
Subject string `json:"subject"`
HTML string `json:"html,omitempty"`
Text string `json:"text,omitempty"`
}
func (s *resend) Send(ctx context.Context, key string, email model.Email) Outcome {
from := (&mail.Address{Name: s.settings.SenderName, Address: s.settings.SenderAddress}).String()
return s.post(ctx, key, resendRequest{From: from, To: []string{email.Address}, Subject: email.Subject, HTML: email.HTML, Text: email.Text})
}