mirror of
https://github.com/containrrr/watchtower.git
synced 2025-12-14 14:10:12 +01:00
Add date header to mail (#164)
Added Date header, date format to RFC1123Z
This commit is contained in:
commit
4eb0000e0f
1 changed files with 4 additions and 0 deletions
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/smtp"
|
"net/smtp"
|
||||||
"os"
|
"os"
|
||||||
|
"time"
|
||||||
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
|
@ -54,10 +55,13 @@ func (e *emailTypeNotifier) buildMessage(entries []*log.Entry) []byte {
|
||||||
// We don't use fields in watchtower, so don't bother sending them.
|
// We don't use fields in watchtower, so don't bother sending them.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t := time.Now()
|
||||||
|
|
||||||
header := make(map[string]string)
|
header := make(map[string]string)
|
||||||
header["From"] = e.From
|
header["From"] = e.From
|
||||||
header["To"] = e.To
|
header["To"] = e.To
|
||||||
header["Subject"] = emailSubject
|
header["Subject"] = emailSubject
|
||||||
|
header["Date"] = t.Format(time.RFC1123Z)
|
||||||
header["MIME-Version"] = "1.0"
|
header["MIME-Version"] = "1.0"
|
||||||
header["Content-Type"] = "text/plain; charset=\"utf-8\""
|
header["Content-Type"] = "text/plain; charset=\"utf-8\""
|
||||||
header["Content-Transfer-Encoding"] = "base64"
|
header["Content-Transfer-Encoding"] = "base64"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue