Documentation
¶
Index ¶
- Constants
- Variables
- func HandleWebhook(res http.ResponseWriter, req *http.Request)
- func SendTemplatedEmail(ctx context.Context, to string, templateID string, ...) error
- func WithTemplateVariable(key string, value any) templateEmailOption
- type Attachment
- type Config
- type EmailRecieved
- type ReceivedEmail
- type WebhookEmailReceieved
Constants ¶
View Source
const ( // ConfigEnvPrefix is the prefix applied to environment variables for configuring Resend. ConfigEnvPrefix = config.ConfigEnvPrefix + "RESEND_" )
Variables ¶
View Source
var ErrInvalidEmail = errors.New("email is invalid")
Functions ¶
func HandleWebhook ¶
func HandleWebhook(res http.ResponseWriter, req *http.Request)
HandleWebhook will handle incoming webhook requests from Resend.
func SendTemplatedEmail ¶ added in v0.47.0
func SendTemplatedEmail(ctx context.Context, to string, templateID string, options ...templateEmailOption) error
SendTemplateEmail sends the template with the given id to the given address, with any additional template options applied.
func WithTemplateVariable ¶ added in v0.48.0
Types ¶
type Attachment ¶ added in v0.25.0
type Config ¶
type Config struct {
WebHookSecret string `koanf:"webhooksecret" validate:"required"`
APIKey string `koanf:"apikey" validate:"required"`
}
Config structure.
type EmailRecieved ¶ added in v0.25.0
type EmailRecieved struct {
EmailId string `json:"email_id,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
From string `json:"from,omitempty"`
To []string `json:"to,omitempty"`
Bcc []string `json:"bcc,omitempty"`
Cc []string `json:"cc,omitempty"`
MessageId string `json:"message_id,omitempty"`
Subject string `json:"subject,omitempty"`
Attachments []Attachment `json:"attachments,omitempty"`
}
type ReceivedEmail ¶ added in v0.25.0
type ReceivedEmail struct {
*resend.ReceivedEmail
}
func (*ReceivedEmail) GetBody ¶ added in v0.25.0
func (e *ReceivedEmail) GetBody() string
func (*ReceivedEmail) GetFrom ¶ added in v0.25.0
func (e *ReceivedEmail) GetFrom() *mail.Address
func (*ReceivedEmail) GetID ¶ added in v0.25.0
func (e *ReceivedEmail) GetID() string
func (*ReceivedEmail) GetSubject ¶ added in v0.25.0
func (e *ReceivedEmail) GetSubject() string
func (*ReceivedEmail) Timestamp ¶ added in v0.25.0
func (e *ReceivedEmail) Timestamp() time.Time
func (*ReceivedEmail) Valid ¶ added in v0.25.0
func (e *ReceivedEmail) Valid() error
Valid returns a non-nil error when the ReceivedEmail contains invalid fields.
type WebhookEmailReceieved ¶ added in v0.25.0
type WebhookEmailReceieved struct {
Type string `json:"type,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
Data EmailRecieved `json:"data,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.