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",
|
ServerAddress: "smtp.example.com",
|
||||||
ServerPort: 587,
|
ServerPort: 587,
|
||||||
FromAddress: "noreply@example.com",
|
FromAddress: "noreply@example.com",
|
||||||
FromAddressPassword: "",
|
|
||||||
FromName: "Handmade Network Team",
|
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.
|
ForceToAddress: "localdev@example.com", // NOTE(asaf): If this is not empty, all emails will be sent to this address.
|
||||||
},
|
},
|
||||||
|
|
|
@ -63,7 +63,8 @@ type EmailConfig struct {
|
||||||
ServerAddress string
|
ServerAddress string
|
||||||
ServerPort int
|
ServerPort int
|
||||||
FromAddress string
|
FromAddress string
|
||||||
FromAddressPassword string
|
MailerUsername string
|
||||||
|
MailerPassword string
|
||||||
FromName string
|
FromName string
|
||||||
ForceToAddress string
|
ForceToAddress string
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,7 @@ func sendMail(toAddress, toName, subject, contentHtml string) error {
|
||||||
)
|
)
|
||||||
return smtp.SendMail(
|
return smtp.SendMail(
|
||||||
fmt.Sprintf("%s:%d", config.Config.Email.ServerAddress, config.Config.Email.ServerPort),
|
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,
|
config.Config.Email.FromAddress,
|
||||||
[]string{toAddress},
|
[]string{toAddress},
|
||||||
contents,
|
contents,
|
||||||
|
|
Loading…
Reference in New Issue