mirror of
https://gitlab.com/ric_harvey/MailHog.git
synced 2025-03-13 03:54:46 +00:00
Improve received header
This commit is contained in:
parent
05d9c9ddeb
commit
c4aebd5d66
2 changed files with 3 additions and 2 deletions
|
@ -49,7 +49,7 @@ func ParseSMTPMessage(c *mailhog.Config, m *SMTPMessage) *Message {
|
|||
Created: time.Now(),
|
||||
}
|
||||
msg.Content.Headers["Message-ID"] = []string{msg.Id + "@" + c.Hostname} // FIXME
|
||||
msg.Content.Headers["Received"] = []string{"from " + m.Helo + " by " + c.Hostname + " (Go-MailHog)"} // FIXME
|
||||
msg.Content.Headers["Received"] = []string{"from " + m.Helo + " by " + c.Hostname + " (Go-MailHog)\r\n id " + msg.Id + "@" + c.Hostname + "; " + time.Now().Format(time.RFC1123Z)}
|
||||
msg.Content.Headers["Return-Path"] = []string{"<" + m.From + ">"}
|
||||
return msg
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import (
|
|||
"testing"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"net"
|
||||
"strings"
|
||||
"regexp"
|
||||
"github.com/ian-kent/MailHog/mailhog/storage"
|
||||
)
|
||||
|
@ -106,7 +107,7 @@ func TestBasicHappyPath(t *testing.T) {
|
|||
assert.Equal(t, message.Content.Headers["Content-Length"], []string{"220"}, "Content-Length is 220")
|
||||
assert.Equal(t, message.Content.Headers["To"], []string{"Someone <someone@mailhog.example>"}, "To is Someone <someone@mailhog.example>")
|
||||
assert.Equal(t, message.Content.Headers["From"], []string{"Nobody <nobody@mailhog.example>"}, "From is Nobody <nobody@mailhog.example>")
|
||||
assert.Equal(t, message.Content.Headers["Received"], []string{"from localhost by mailhog.example (Go-MailHog)"}, "Received is from localhost by mailhog.example (Go-MailHog)")
|
||||
assert.True(t, strings.HasPrefix(message.Content.Headers["Received"][0], "from localhost by mailhog.example (Go-MailHog)\r\n id " + match[1] + "@mailhog.example; "), "Received header is correct")
|
||||
assert.Equal(t, message.Content.Headers["Return-Path"], []string{"<nobody@mailhog.example>"}, "Return-Path is <nobody@mailhog.example>")
|
||||
assert.Equal(t, message.Content.Headers["Message-ID"], []string{match[1] + "@mailhog.example"}, "Message-ID is " + match[1] + "@mailhog.example")
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue