From 3f08c160ecf55cbd8bf98df0194fa1cdb79ca435 Mon Sep 17 00:00:00 2001 From: Jordan Wright Date: Wed, 17 Feb 2016 21:09:19 -0600 Subject: [PATCH] Added ability to have "{{.From}}" in sending a test email. Fixes #162 --- models/campaign.go | 1 + worker/worker.go | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/models/campaign.go b/models/campaign.go index b813d456..69726650 100644 --- a/models/campaign.go +++ b/models/campaign.go @@ -72,6 +72,7 @@ type SendTestEmailRequest struct { URL string `json:"url"` Tracker string `json:"tracker"` TrackingURL string `json:"tracking_url"` + From string `json:"from"` Target } diff --git a/worker/worker.go b/worker/worker.go index 904b2849..67259de3 100644 --- a/worker/worker.go +++ b/worker/worker.go @@ -178,9 +178,9 @@ func SendTestEmail(s *models.SendTestEmailRequest) error { Logger.Println(err) return err } - ft := f.Name - if ft == "" { - ft = f.Address + s.From = f.Name + if s.From == "" { + s.From = f.Address } Logger.Println("Creating email using template") // Parse the templates