go-smtp-mock icon indicating copy to clipboard operation
go-smtp-mock copied to clipboard

[FEATURE] Easy asserts for mail data

Open codedge opened this issue 2 years ago • 0 comments

New feature request checklist

Feature description

When testing an email delivery, I also want to be sure, that the inner things of an email are correct. For this I am currently missing the suitable getters.

I would like to test

Content Type (text/plain or text/html)

assert.Equal(t, "text/html", server.Messages()[0].ContentType())

Content contains a certain string

assert.Contains(t, "Sample text", server.Messages()[0].Content())

Subject is/contains a certain string

assert.Contains(t, "Example", server.Messages()[0].Subject())
assert.Equals(t, "Example", server.Messages()[0].Subject())

codedge avatar Mar 06 '23 20:03 codedge