influxdata / influxdata/kapacitor
Email failure due to HELO (LocalName defaults to localhost)
- Dominant language
- Go
- Stars
- 2.4k
- Forks
- 479
- Avg merge
- 4d 16h
- Merged PRs (30d)
- 4
Description
Hi,
The library used to send email in Kapacitor (go-gomail) has a [default value](https://github.com/go-gomail/gomail/blob/v2/smtp.go#L14) for `LocalName` set to `localhost` and does not seem to be overwritten by any Kapacitor config settings.
This leads to a invalid `HELO` on any of the more stricter mailservers out there, as can be seen in the log below.
**kapacitor.log**
```
ts=2020-07-17T08:05:57.183Z lvl=error msg="error sending" service=smtp err="gomail: could not send email 1: 504 5.5.2 : Helo command rejected: need fully-qualified hostname"
```
**mail.log (on the mail server)**
```
Jul 17 10:05:57 mail01 postfix/smtpd[1002]: NOQUEUE: reject: RCPT from unknown[x.x.x.x]: 504 5.5.2 : Helo command rejected: need fully-qualified hostname; from= to= proto=ESMTP helo=
```
Having `LocalName` set in de Dialer to the `hostname` setting in Kapacitor would be a more sensible default.
I have seem similar issues reported in #660, however the main focus of that ticket were other issues so opening this new one.
Contributor guide
Research direction
Start by locating Kapacitor's SMTP dialer construction and the hostname configuration, then compare it with go-gomail's smtp.go LocalName default. Verify that the resulting HELO uses the configured hostname and test email delivery against a server requiring a fully qualified hostname.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100