42 lines
673 B
Go
42 lines
673 B
Go
|
package email
|
||
|
|
||
|
import (
|
||
|
"crypto/tls"
|
||
|
"io"
|
||
|
"net/smtp"
|
||
|
)
|
||
|
|
||
|
type MockWriter struct{}
|
||
|
|
||
|
func (w *MockWriter) Close() error {
|
||
|
return nil
|
||
|
}
|
||
|
func (w *MockWriter) Write(p []byte) (n int, err error) {
|
||
|
return 10, nil
|
||
|
}
|
||
|
|
||
|
// Mock SMTP Client
|
||
|
type MockSMTP struct{}
|
||
|
|
||
|
func (m *MockSMTP) StartTLS(*tls.Config) error {
|
||
|
return nil
|
||
|
}
|
||
|
func (m *MockSMTP) Auth(a smtp.Auth) error {
|
||
|
return nil
|
||
|
}
|
||
|
func (m *MockSMTP) Close() error {
|
||
|
return nil
|
||
|
}
|
||
|
func (m *MockSMTP) Data() (io.WriteCloser, error) {
|
||
|
return &MockWriter{}, nil
|
||
|
}
|
||
|
func (m *MockSMTP) Mail(from string) error {
|
||
|
return nil
|
||
|
}
|
||
|
func (m *MockSMTP) Quit() error {
|
||
|
return nil
|
||
|
}
|
||
|
func (m *MockSMTP) Rcpt(to string) error {
|
||
|
return nil
|
||
|
}
|