mirror of
https://github.com/Jinnrry/PMail.git
synced 2025-10-08 18:00:08 +08:00
33 lines
877 B
Go
33 lines
877 B
Go
package hooks
|
||
|
||
import (
|
||
"pmail/dto/parsemail"
|
||
"pmail/hooks/telegram_push"
|
||
"pmail/hooks/web_push"
|
||
"pmail/hooks/wechat_push"
|
||
"pmail/utils/context"
|
||
)
|
||
|
||
type EmailHook interface {
|
||
// SendBefore 邮件发送前的数据
|
||
SendBefore(ctx *context.Context, email *parsemail.Email)
|
||
// SendAfter 邮件发送后的数据,err是每个收信服务器的错误信息
|
||
SendAfter(ctx *context.Context, email *parsemail.Email, err map[string]error)
|
||
// ReceiveParseBefore 接收到邮件,解析之前的原始数据
|
||
ReceiveParseBefore(email []byte)
|
||
// ReceiveParseAfter 接收到邮件,解析之后的结构化数据
|
||
ReceiveParseAfter(email *parsemail.Email)
|
||
}
|
||
|
||
// HookList
|
||
var HookList []EmailHook
|
||
|
||
// Init 这里注册hook对象
|
||
func Init() {
|
||
HookList = []EmailHook{
|
||
wechat_push.NewWechatPushHook(),
|
||
telegram_push.NewTelegramPushHook(),
|
||
web_push.NewWebPushHook(),
|
||
}
|
||
}
|