mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-08 23:12:54 +01:00
#42: Add test for Msg.WriteToSendmail
This commit is contained in:
parent
333c3970e7
commit
6d22a34548
1 changed files with 17 additions and 0 deletions
|
@ -9,6 +9,7 @@ package mail
|
|||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
@ -38,3 +39,19 @@ func TestMsg_WriteToSendmailWithContext(t *testing.T) {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
// TestMsg_WriteToSendmail will test the output to the local sendmail command
|
||||
func TestMsg_WriteToSendmail(t *testing.T) {
|
||||
_, err := os.Stat(SendmailPath)
|
||||
if err != nil {
|
||||
t.Skipf("local sendmail command not found in expected path. Skipping")
|
||||
}
|
||||
|
||||
m := NewMsg()
|
||||
_ = m.From("Toni Tester <tester@example.com>")
|
||||
_ = m.To(TestRcpt)
|
||||
m.SetBodyString(TypeTextPlain, "This is a test")
|
||||
if err := m.WriteToSendmail(); err != nil {
|
||||
t.Errorf("WriteToSendmail failed: %s", err)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue