-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR implements support for multiple recipients via a new `to_list` field that replaces the `to` field. This is natively supported by the `smtp.SendMail` function.
- Loading branch information
Showing
4 changed files
with
45 additions
and
13 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 |
---|---|---|
|
@@ -26,7 +26,9 @@ func TestAccEmail_basic(t *testing.T) { | |
Check: resource.ComposeTestCheckFunc( | ||
testAccCheckEmailExists("email_email.example"), | ||
resource.TestCheckResourceAttr( | ||
"email_email.example", "to", "[email protected]"), | ||
"email_email.example", "to_list.#", "1"), | ||
resource.TestCheckResourceAttr( | ||
"email_email.example", "to_list.0", "[email protected]"), | ||
resource.TestCheckResourceAttr( | ||
"email_email.example", "from", "[email protected]"), | ||
resource.TestCheckResourceAttr( | ||
|
@@ -115,7 +117,7 @@ func TestRetryWorkflow(t *testing.T) { | |
t.Run(test.name, func(t *testing.T) { | ||
// set test retries zero before each test | ||
sendMailInvocations = 0 | ||
err := sendMail(test.sendMailFunc, maxRetries, "localhost", "2525", "username", "password", "[email protected]", "[email protected]", "message") | ||
err := sendMail(test.sendMailFunc, maxRetries, "localhost", "2525", "username", "password", "[email protected]", []string{"[email protected]"}, "message") | ||
if test.expectedErr != nil { | ||
// assert that the errors are equal | ||
assert.EqualError(t, err, test.expectedErr.Error()) | ||
|
@@ -132,7 +134,7 @@ func TestRetryWorkflow(t *testing.T) { | |
// `docker run --rm -it -p 3000:80 -p 2525:25 rnwood/smtp4dev:v3` | ||
const testAccEmailConfig = ` | ||
resource "email_email" "example" { | ||
to = "[email protected]" | ||
to_list = ["[email protected]"] | ||
from = "[email protected]" | ||
reply_to = "[email protected]" | ||
subject = "Test Subject" | ||
|
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 |
---|---|---|
|
@@ -11,7 +11,7 @@ provider "email" {} | |
|
||
|
||
resource "email_email" "example" { | ||
to = "[email protected]" | ||
to_list = ["[email protected]"] | ||
to_display_name = "Infrastructure Outreach <[email protected]>" | ||
from = "[email protected]" | ||
from_display_name = "Sentry Outgoing <[email protected]>" | ||
|
@@ -27,7 +27,7 @@ resource "email_email" "example" { | |
} | ||
|
||
resource "email_email" "example_with_styling" { | ||
to = "[email protected]" | ||
to_list = ["[email protected]"] | ||
to_display_name = "Infrastructure Outreach <[email protected]>" | ||
from = "[email protected]" | ||
from_display_name = "Sentry Outgoing <[email protected]>" | ||
|