-
Notifications
You must be signed in to change notification settings - Fork 14
/
sender.go
39 lines (32 loc) · 1.03 KB
/
sender.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package mail
import (
"github.com/latolukasz/beeorm"
"github.com/coretrix/hitrix/service/component/config"
)
type NewSenderFunc func(configService config.IConfig) (Sender, error)
type Sender interface {
GetTemplateKeyFromConfig(configService config.IConfig, templateName string) (string, error)
SendTemplate(ormService *beeorm.Engine, message *Message) error
SendTemplateAsync(ormService *beeorm.Engine, message *Message) error
SendTemplateWithAttachments(ormService *beeorm.Engine, message *MessageAttachment) error
SendTemplateWithAttachmentsAsync(ormService *beeorm.Engine, message *MessageAttachment) error
GetTemplateHTMLCode(ormService *beeorm.Engine, templateName string, ttl int) (string, error)
}
type Message struct {
From string
FromName string
ReplyTo string
To string
Subject string
TemplateName string
TemplateData interface{}
}
type Attachment struct {
ContentType string
Filename string
Base64Content string
}
type MessageAttachment struct {
Message
Attachments []Attachment
}