Now setting configured hostname when sending emails. Fixes #317

pull/322/head
Jordan Wright 2016-07-06 23:25:28 -05:00
parent d05a062a17
commit 5cdfcbfe37
1 changed files with 12 additions and 0 deletions

View File

@ -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)