-
Notifications
You must be signed in to change notification settings - Fork 471
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: utilize custom SMTP domain if set
- Loading branch information
1 parent
26de929
commit eca9ae7
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ var testFunctions = [...]func(*testing.T, fleet.MailService){ | |
testSMTPPlainAuthInvalidCreds, | ||
testSMTPSkipVerify, | ||
testSMTPNoAuthWithTLS, | ||
testSMTPDomain, | ||
testMailTest, | ||
} | ||
|
||
|
@@ -159,6 +160,31 @@ func testSMTPNoAuthWithTLS(t *testing.T, mailer fleet.MailService) { | |
assert.Nil(t, err) | ||
} | ||
|
||
func testSMTPDomain(t *testing.T, mailer fleet.MailService) { | ||
mail := fleet.Email{ | ||
Subject: "custom client hello", | ||
To: []string{"[email protected]"}, | ||
SMTPSettings: fleet.SMTPSettings{ | ||
SMTPConfigured: true, | ||
SMTPAuthenticationType: fleet.AuthTypeNameNone, | ||
SMTPEnableTLS: false, | ||
SMTPVerifySSLCerts: false, | ||
SMTPEnableStartTLS: false, | ||
SMTPPort: 1027, | ||
SMTPServer: "localhost", | ||
SMTPDomain: "foo.com", | ||
SMTPSenderAddress: "[email protected]", | ||
}, | ||
Mailer: &SMTPTestMailer{ | ||
BaseURL: "https://localhost:8080", | ||
}, | ||
} | ||
|
||
err := mailer.SendEmail(mail) | ||
assert.Nil(t, err) | ||
|
||
} | ||
|
||
func testMailTest(t *testing.T, mailer fleet.MailService) { | ||
mail := fleet.Email{ | ||
Subject: "test tester", | ||
|