From 5cdfcbfe370179dcea2d8a691e774b9ed0fed03c Mon Sep 17 00:00:00 2001 From: Jordan Wright Date: Wed, 6 Jul 2016 23:25:28 -0500 Subject: [PATCH] Now setting configured hostname when sending emails. Fixes #317 --- worker/worker.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/worker/worker.go b/worker/worker.go index 3f3073d7..b7e61f2d 100644 --- a/worker/worker.go +++ b/worker/worker.go @@ -78,6 +78,12 @@ func processCampaign(c *models.Campaign) { ServerName: c.SMTP.Host, InsecureSkipVerify: c.SMTP.IgnoreCertErrors, } + hostname, err := os.Hostname() + if err != nil { + Logger.Println(err) + hostname = "localhost" + } + d.LocalName = hostname s, err := d.Dial() // Short circuit if we have an err // However, we still need to update each target @@ -218,6 +224,12 @@ func SendTestEmail(s *models.SendTestEmailRequest) error { ServerName: s.SMTP.Host, InsecureSkipVerify: s.SMTP.IgnoreCertErrors, } + hostname, err := os.Hostname() + if err != nil { + Logger.Println(err) + hostname = "localhost" + } + d.LocalName = hostname dc, err := d.Dial() if err != nil { Logger.Println(err)