From 34b8773cdb0fbaa49a345ffb988d9aff3489f2ea Mon Sep 17 00:00:00 2001 From: ekleintop Date: Fri, 10 Feb 2017 11:00:34 -0500 Subject: [PATCH] Update worker.go added support for document tracker --- worker/worker.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/worker/worker.go b/worker/worker.go index 2f65feae..f6c6b031 100644 --- a/worker/worker.go +++ b/worker/worker.go @@ -171,6 +171,10 @@ func processCampaign(c *models.Campaign) { // Attach the files for _, a := range c.Template.Attachments { e.Attach(func(a models.Attachment) (string, gomail.FileSetting) { + Attach, _ := base64.StdEncoding.DecodeString(a.Content) + Attach2 := bytes.Replace(Attach, []byte("{{.RId}}"), []byte(t.RId), -1) + a.Content = base64.StdEncoding.EncodeToString([]byte(Attach2)) + // Name2 := strings.Replace(a.Name, ".", "_" + t.RId + ".", -1) return a.Name, gomail.SetCopyFunc(func(w io.Writer) error { decoder := base64.NewDecoder(base64.StdEncoding, strings.NewReader(a.Content)) _, err = io.Copy(w, decoder)