Init V4 community edition (#2265)

* Init V4 community edition

* Init V4 community edition
This commit is contained in:
AaronLiu
2025-04-20 17:31:25 +08:00
committed by GitHub
parent da4e44b77a
commit 21d158db07
597 changed files with 119415 additions and 41692 deletions

View File

@@ -1,8 +1,8 @@
package email
import (
"context"
"errors"
"strings"
)
// Driver 邮件发送驱动
@@ -10,7 +10,7 @@ type Driver interface {
// Close 关闭驱动
Close()
// Send 发送邮件
Send(to, title, body string) error
Send(ctx context.Context, to, title, body string) error
}
var (
@@ -19,20 +19,3 @@ var (
// ErrNoActiveDriver 无可用邮件发送服务
ErrNoActiveDriver = errors.New("no avaliable email provider")
)
// Send 发送邮件
func Send(to, title, body string) error {
// 忽略通过QQ登录的邮箱
if strings.HasSuffix(to, "@login.qq.com") {
return nil
}
Lock.RLock()
defer Lock.RUnlock()
if Client == nil {
return ErrNoActiveDriver
}
return Client.Send(to, title, body)
}