Allow separate mailer account and From address
This commit is contained in:
parent
b27ddd1e7f
commit
ca663d874b
|
@ -35,8 +35,9 @@ var Config = HMNConfig{
|
|||
ServerAddress: "smtp.example.com",
|
||||
ServerPort: 587,
|
||||
FromAddress: "noreply@example.com",
|
||||
FromAddressPassword: "",
|
||||
FromName: "Handmade Network Team",
|
||||
MailerUsername: "actualuser@example.com",
|
||||
MailerPassword: "",
|
||||
|
||||
ForceToAddress: "localdev@example.com", // NOTE(asaf): If this is not empty, all emails will be sent to this address.
|
||||
},
|
||||
|
|
|
@ -60,12 +60,13 @@ type DigitalOceanConfig struct {
|
|||
}
|
||||
|
||||
type EmailConfig struct {
|
||||
ServerAddress string
|
||||
ServerPort int
|
||||
FromAddress string
|
||||
FromAddressPassword string
|
||||
FromName string
|
||||
ForceToAddress string
|
||||
ServerAddress string
|
||||
ServerPort int
|
||||
FromAddress string
|
||||
MailerUsername string
|
||||
MailerPassword string
|
||||
FromName string
|
||||
ForceToAddress string
|
||||
}
|
||||
|
||||
type DiscordConfig struct {
|
||||
|
|
|
@ -124,7 +124,7 @@ func sendMail(toAddress, toName, subject, contentHtml string) error {
|
|||
)
|
||||
return smtp.SendMail(
|
||||
fmt.Sprintf("%s:%d", config.Config.Email.ServerAddress, config.Config.Email.ServerPort),
|
||||
smtp.PlainAuth("", config.Config.Email.FromAddress, config.Config.Email.FromAddressPassword, config.Config.Email.ServerAddress),
|
||||
smtp.PlainAuth("", config.Config.Email.MailerUsername, config.Config.Email.MailerPassword, config.Config.Email.ServerAddress),
|
||||
config.Config.Email.FromAddress,
|
||||
[]string{toAddress},
|
||||
contents,
|
||||
|
|
Loading…
Reference in New Issue