backend moved to separate directory
backend: deleted the old structure
This commit is contained in:
33
go-backend/internal/utils/mock_smtp.go
Normal file
33
go-backend/internal/utils/mock_smtp.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
smtpmock "github.com/mocktools/go-smtp-mock/v2"
|
||||
)
|
||||
|
||||
var Server smtpmock.Server
|
||||
|
||||
// StartMockSMTPServer starts a mock SMTP server for testing
|
||||
func SMTPStart(host string, port int) error {
|
||||
Server = *smtpmock.New(smtpmock.ConfigurationAttr{
|
||||
HostAddress: host,
|
||||
PortNumber: port,
|
||||
LogToStdout: false,
|
||||
LogServerActivity: false,
|
||||
})
|
||||
if err := Server.Start(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func SMTPGetMessages() []smtpmock.Message {
|
||||
return Server.MessagesAndPurge()
|
||||
}
|
||||
|
||||
func SMTPStop() error {
|
||||
|
||||
if err := Server.Stop(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user