fix!: SMTP now works properly in non-dev environments
This commit is contained in:
parent
43d4e6caee
commit
1c1b2a3a1d
1 changed files with 3 additions and 6 deletions
7
main.go
7
main.go
|
|
@ -149,6 +149,7 @@ func main() {
|
|||
var smtpUsername = os.Getenv("SMTP_USERNAME")
|
||||
var smtpPassword = os.Getenv("SMTP_PASSWORD")
|
||||
var smtpHost = os.Getenv("SMTP_HOST")
|
||||
var smtpPort = os.Getenv("SMTP_PORT")
|
||||
var smtpRecipients = os.Getenv("SMTP_RECIPIENTS")
|
||||
client := CreateBudgetClient(baseUrl, apiKey, syncId, encryptionKey)
|
||||
if !client.BankSync() {
|
||||
|
|
@ -184,12 +185,8 @@ func main() {
|
|||
message := []byte(subject + mime + body + categories.String())
|
||||
|
||||
var auth smtp.Auth
|
||||
if os.Getenv("ENVIRONMENT") == "dev" {
|
||||
auth = nil
|
||||
} else {
|
||||
auth = smtp.PlainAuth("", smtpUsername, smtpPassword, smtpHost)
|
||||
}
|
||||
err := smtp.SendMail(smtpHost, auth, smtpUsername, strings.Split(smtpRecipients, ","), []byte(message))
|
||||
err := smtp.SendMail(smtpHost+":"+smtpPort, auth, smtpUsername, strings.Split(smtpRecipients, ","), []byte(message))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue