diff --git a/app/email/email_test.go b/app/email/email_test.go index 2151c3b3eb..37103f2836 100644 --- a/app/email/email_test.go +++ b/app/email/email_test.go @@ -222,3 +222,41 @@ func TestSendCloudTrialEndWarningEmail(t *testing.T) { verifyMailbox(t) }) } + +func TestSendCloudTrialEndedEmail(t *testing.T) { + th := Setup(t).InitBasic() + defer th.TearDown() + th.ConfigureInbucketMail() + + emailTo := "testclouduser@example.com" + emailToUsername := strings.Split(emailTo, "@")[0] + + t.Run("SendCloudTrialEndedEmail", func(t *testing.T) { + verifyMailbox := func(t *testing.T) { + t.Helper() + + var resultsMailbox mail.JSONMessageHeaderInbucket + err2 := mail.RetryInbucket(5, func() error { + var err error + resultsMailbox, err = mail.GetMailBox(emailTo) + return err + }) + if err2 != nil { + t.Skipf("No email was received, maybe due load on the server: %v", err2) + } + + require.Len(t, resultsMailbox, 1) + require.Contains(t, resultsMailbox[0].To[0], emailTo, "Wrong To: recipient") + resultsEmail, err := mail.GetMessageFromMailbox(emailTo, resultsMailbox[0].ID) + require.NoError(t, err, "Could not get message from mailbox") + require.Contains(t, resultsEmail.Body.Text, "your 14-day free trial of Mattermost Cloud Enterprise has ended today", "Wrong received message %s", resultsEmail.Body.Text) + require.Contains(t, resultsEmail.Body.Text, "we will delete your Cloud workspace permanently", "Wrong received message %s", resultsEmail.Body.Text) + } + mail.DeleteMailBox(emailTo) + + err := th.service.SendCloudTrialEndedEmail(emailTo, emailToUsername, "June 23, 2200", th.BasicUser.Locale) + require.NoError(t, err) + + verifyMailbox(t) + }) +} diff --git a/i18n/en.json b/i18n/en.json index def55168b9..e5ca71e033 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -3121,7 +3121,7 @@ }, { "id": "api.templates.cloud_trial_ended_email.subtitle", - "translation": "{{.Name}}, your 14-day free trial of Mattermost Cloud Enterprise has ended today, {{.TodayDate}}. Please add your payment information to ensure your team can continue enjoying the benefits of Cloud Enterprise." + "translation": "{{.Name}}, your 14-day free trial of Mattermost Cloud Enterprise has ended today, {{.TodayDate}}. Please add your payment information to ensure your team can continue enjoying the benefits of Cloud Enterprise. If you do not add your payment information within 30 days, we will delete your Cloud workspace permanently and you will lose any associated data." }, { "id": "api.templates.cloud_trial_ended_email.title",