Initial email settings UI commit

Added email settings page, settings now save in database, ability to send an email to client when it's created
This commit is contained in:
Arminas 2022-12-30 19:10:27 +02:00 committed by GitHub
parent f8a10417ea
commit c31636b66e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 568 additions and 25 deletions
emailer

View file

@ -20,7 +20,7 @@ type SmtpMail struct {
from string
}
func authType(authType string) mail.AuthType {
func AuthType(authType string) mail.AuthType {
switch strings.ToUpper(authType) {
case "PLAIN":
return mail.AuthPlain
@ -31,7 +31,7 @@ func authType(authType string) mail.AuthType {
}
}
func encryptionType(encryptionType string) mail.Encryption {
func EncryptionType(encryptionType string) mail.Encryption {
switch strings.ToUpper(encryptionType) {
case "SSL":
return mail.EncryptionSSL
@ -45,7 +45,7 @@ func encryptionType(encryptionType string) mail.Encryption {
}
func NewSmtpMail(hostname string, port int, username string, password string, noTLSCheck bool, auth string, fromName, from string, encryption string) *SmtpMail {
ans := SmtpMail{hostname: hostname, port: port, username: username, password: password, noTLSCheck: noTLSCheck, fromName: fromName, from: from, authType: authType(auth), encryption: encryptionType(encryption)}
ans := SmtpMail{hostname: hostname, port: port, username: username, password: password, noTLSCheck: noTLSCheck, fromName: fromName, from: from, authType: AuthType(auth), encryption: EncryptionType(encryption)}
return &ans
}