Skip to content

Commit a7968a9

Browse files
authored
Merge pull request #8 from symfonycorp/mail-host
Allow to change the hostname used to send emails
2 parents f0d9179 + 726ea34 commit a7968a9

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

CHANGELOG

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
1.3.0
22
-----
33

4-
* Allow to set email sender
4+
* Allow to change the hostname used to send emails (via `MAILHOST` env var)
5+
* Allow to set email sender (via `MAILFROM` env var)
56
* Fix timeout support when the command starts sub-processes
67
* Add go.mod
78

main.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,11 @@ func (r *result) sendEmail() {
191191
}
192192

193193
func (r *result) subject() string {
194-
hostname, err := os.Hostname()
195-
if err != nil {
194+
hostname := "undefined"
195+
var err error
196+
if env := os.Getenv("MAILHOST"); env != "" {
197+
hostname = env
198+
} else if hostname, err = os.Hostname(); err != nil {
196199
hostname = "undefined"
197200
}
198201

0 commit comments

Comments
 (0)