add initial email service
This commit is contained in:
parent
0ae9cd7133
commit
4448c4a841
1 changed files with 32 additions and 0 deletions
32
internal/service/email.go
Normal file
32
internal/service/email.go
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
package service
|
||||||
|
|
||||||
|
import "context"
|
||||||
|
|
||||||
|
type EmailParams struct {
|
||||||
|
From string
|
||||||
|
To []string
|
||||||
|
Subject string
|
||||||
|
Text string
|
||||||
|
}
|
||||||
|
|
||||||
|
type EmailClient interface {
|
||||||
|
SendWithContext(ctx context.Context, params EmailParams) (string, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type EmailService struct {
|
||||||
|
client EmailClient
|
||||||
|
fromEmail string
|
||||||
|
isDev bool
|
||||||
|
appURL string
|
||||||
|
appName string
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewEmailService(client EmailClient, fromEmail, appURL, appName string, isDev bool) *EmailService {
|
||||||
|
return &EmailService{
|
||||||
|
client: client,
|
||||||
|
fromEmail: fromEmail,
|
||||||
|
isDev: isDev,
|
||||||
|
appURL: appURL,
|
||||||
|
appName: appName,
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue