Rename the email override field for clarity

This commit is contained in:
Ben Visness 2022-05-25 17:39:57 -05:00
parent 2f19e6e1b8
commit 68a00c91db
3 changed files with 15 additions and 14 deletions

View File

@ -30,12 +30,13 @@ var Config = HMNConfig{
AtomPassword: "password",
},
Email: EmailConfig{
ServerAddress: "smtp.example.com",
ServerPort: 587,
FromAddress: "noreply@example.com",
FromAddressPassword: "",
FromName: "Handmade Network Team",
OverrideRecipientEmail: "override@handmade.network", // NOTE(asaf): If this is not empty, all emails will be redirected to this address.
ServerAddress: "smtp.example.com",
ServerPort: 587,
FromAddress: "noreply@example.com",
FromAddressPassword: "",
FromName: "Handmade Network Team",
ForceToAddress: "localdev@example.com", // NOTE(asaf): If this is not empty, all emails will be sent to this address.
},
DigitalOcean: DigitalOceanConfig{
AssetsSpacesKey: "dummy",

View File

@ -60,12 +60,12 @@ type DigitalOceanConfig struct {
}
type EmailConfig struct {
ServerAddress string
ServerPort int
FromAddress string
FromAddressPassword string
FromName string
OverrideRecipientEmail string
ServerAddress string
ServerPort int
FromAddress string
FromAddressPassword string
FromName string
ForceToAddress string
}
type DiscordConfig struct {

View File

@ -106,8 +106,8 @@ func renderTemplate(name string, data interface{}) (string, error) {
}
func sendMail(toAddress, toName, subject, contentHtml string) error {
if config.Config.Email.OverrideRecipientEmail != "" {
toAddress = config.Config.Email.OverrideRecipientEmail
if config.Config.Email.ForceToAddress != "" {
toAddress = config.Config.Email.ForceToAddress
}
contents := prepMailContents(
makeHeaderAddress(toAddress, toName),