This repository has been archived by the owner on Feb 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
email.go
64 lines (52 loc) · 1.47 KB
/
email.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package globals
import (
"github.com/go-playground/log"
)
// EmailSettings contains all email settings related information
type EmailSettings interface {
SMTPServer() string
SMTPUsername() string
SMTPPassword() string
ContactEmail() string
SMTPPort() int
}
// emailSettings contains all email settings related information
type emailSettings struct {
smtpServer string
smtpUsername string
smtpPassword string
contactEmail string
smtpPort int
}
var _ EmailSettings = new(emailSettings)
// newEmail returns a new email instance
func newEmail(smtpServer string, smtpUsername string, smtpPassword string, smtpPort int, contactEmail string) EmailSettings {
log.Info("Initializing Email Settings")
return &emailSettings{
smtpServer: smtpServer,
smtpUsername: smtpUsername,
smtpPassword: smtpPassword,
contactEmail: contactEmail,
smtpPort: smtpPort,
}
}
// SMTPServer returns the applications SMTP server
func (e *emailSettings) SMTPServer() string {
return e.smtpServer
}
// SMTPUsername returns the applications SMTP username
func (e *emailSettings) SMTPUsername() string {
return e.smtpUsername
}
// SMTPPassword returns the applications SMTP password
func (e *emailSettings) SMTPPassword() string {
return e.smtpPassword
}
// SMTPPort returns the applications SMTP port
func (e *emailSettings) SMTPPort() int {
return e.smtpPort
}
// ContactEmail returns the applications contact email
func (e *emailSettings) ContactEmail() string {
return e.contactEmail
}