Files
PMail/server/hooks/base.go

33 lines
877 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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(),
}
}