aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2024-11-29 17:15:41 -0800
committerGitHub <noreply@github.com>2024-11-30 01:15:41 +0000
commit79d593a9be48d8281ce9418906a540e1f98c2f7c (patch)
treee2a115fce68dbc1afa2c934b17fdb968f4ecf41d /tests
parentfd3aa5bedb07d295d48b1f550c19ad1b387ba83f (diff)
downloadgitea-79d593a9be48d8281ce9418906a540e1f98c2f7c.tar.gz
gitea-79d593a9be48d8281ce9418906a540e1f98c2f7c.zip
Split mail sender sub package from mailer service package (#32618)
Move all mail sender related codes into a sub package of services/mailer. Just move, no code change. Then we just have dependencies on go-mail package in the new sub package. We can use other package to replace it because it's unmaintainable. ref #18664
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/incoming_email_test.go16
1 files changed, 10 insertions, 6 deletions
diff --git a/tests/integration/incoming_email_test.go b/tests/integration/incoming_email_test.go
index 88571303ac..e968a2956e 100644
--- a/tests/integration/incoming_email_test.go
+++ b/tests/integration/incoming_email_test.go
@@ -19,11 +19,11 @@ import (
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/services/mailer/incoming"
incoming_payload "code.gitea.io/gitea/services/mailer/incoming/payload"
+ sender_service "code.gitea.io/gitea/services/mailer/sender"
token_service "code.gitea.io/gitea/services/mailer/token"
"code.gitea.io/gitea/tests"
"github.com/stretchr/testify/assert"
- "gopkg.in/gomail.v2"
)
func TestIncomingEmail(t *testing.T) {
@@ -189,11 +189,15 @@ func TestIncomingEmail(t *testing.T) {
token, err := token_service.CreateToken(token_service.ReplyHandlerType, user, payload)
assert.NoError(t, err)
- msg := gomail.NewMessage()
- msg.SetHeader("To", strings.Replace(setting.IncomingEmail.ReplyToAddress, setting.IncomingEmail.TokenPlaceholder, token, 1))
- msg.SetHeader("From", user.Email)
- msg.SetBody("text/plain", token)
- err = gomail.Send(&smtpTestSender{}, msg)
+ msg := sender_service.NewMessageFrom(
+ strings.Replace(setting.IncomingEmail.ReplyToAddress, setting.IncomingEmail.TokenPlaceholder, token, 1),
+ "",
+ user.Email,
+ "",
+ token,
+ )
+
+ err = sender_service.Send(&smtpTestSender{}, msg)
assert.NoError(t, err)
assert.Eventually(t, func() bool {