Skip to content

Commit

Permalink
Merge pull request go-mail#26 from zcalusic/v2
Browse files Browse the repository at this point in the history
Fix MIME-Version header field case
  • Loading branch information
ivy committed Jun 9, 2018
2 parents 5bc5c8b + 2449c75 commit c55e3fb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- #12: Adds `SendError` to provide additional info about the cause and index of
a failed attempt to transmit a batch of messages.

### Fixed

- #26: Fixes RFC 1341 compliance by properly capitalizing the
`MIME-Version` header.

## [2.2.0] - 2018-03-01

### Added
Expand Down
2 changes: 1 addition & 1 deletion message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ func stubSendMail(t *testing.T, bCount int, want *message) SendFunc {
t.Error(err)
}
got := buf.String()
wantMsg := string("Mime-Version: 1.0\r\n" +
wantMsg := string("MIME-Version: 1.0\r\n" +
"Date: Wed, 25 Jun 2014 17:46:00 +0000\r\n" +
want.content)
if bCount > 0 {
Expand Down
2 changes: 1 addition & 1 deletion send_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const (
testBody = "Test message"
testMsg = "To: " + testTo1 + ", " + testTo2 + "\r\n" +
"From: " + testFrom + "\r\n" +
"Mime-Version: 1.0\r\n" +
"MIME-Version: 1.0\r\n" +
"Date: Wed, 25 Jun 2014 17:46:00 +0000\r\n" +
"Content-Type: text/plain; charset=UTF-8\r\n" +
"Content-Transfer-Encoding: quoted-printable\r\n" +
Expand Down
4 changes: 2 additions & 2 deletions writeto.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ func (m *Message) WriteTo(w io.Writer) (int64, error) {
}

func (w *messageWriter) writeMessage(m *Message) {
if _, ok := m.header["Mime-Version"]; !ok {
w.writeString("Mime-Version: 1.0\r\n")
if _, ok := m.header["MIME-Version"]; !ok {
w.writeString("MIME-Version: 1.0\r\n")
}
if _, ok := m.header["Date"]; !ok {
w.writeHeader("Date", m.FormatDate(now()))
Expand Down

0 comments on commit c55e3fb

Please sign in to comment.