[#75] added option to test s3 connection and send test emails

This commit is contained in:
Gani Georgiev
2022-08-21 14:30:36 +03:00
parent 3f4f4cf031
commit 587cfc335c
49 changed files with 1539 additions and 838 deletions
+12 -3
View File
@@ -11,18 +11,27 @@ var _ mailer.Mailer = (*TestMailer)(nil)
// TestMailer is a mock `mailer.Mailer` implementation.
type TestMailer struct {
TotalSend int
LastHtmlBody string
TotalSend int
LastFromAddress mail.Address
LastToAddress mail.Address
LastHtmlSubject string
LastHtmlBody string
}
// Reset clears any previously test collected data.
func (m *TestMailer) Reset() {
m.LastHtmlBody = ""
m.TotalSend = 0
m.LastFromAddress = mail.Address{}
m.LastToAddress = mail.Address{}
m.LastHtmlSubject = ""
m.LastHtmlBody = ""
}
// Send implements `mailer.Mailer` interface.
func (m *TestMailer) Send(fromEmail mail.Address, toEmail mail.Address, subject string, html string, attachments map[string]io.Reader) error {
m.LastFromAddress = fromEmail
m.LastToAddress = toEmail
m.LastHtmlSubject = subject
m.LastHtmlBody = html
m.TotalSend++
return nil