diff --git a/mail/mail.go b/mail/mail.go index 8fba041..b0edd9b 100644 --- a/mail/mail.go +++ b/mail/mail.go @@ -82,3 +82,15 @@ func (m *Mail) TplSend(mailTo []string, subject string, tpl string, bindData map } return m.BaseSend(mailTo, subject, mailBody) } + +// TplContentSend 使用模版发送邮件 +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 1:05 下午 2021/8/14 +func (m *Mail) TplContentSend(mailTo []string, subject string, tplContent string, bindData map[string]string) error { + for k, v := range bindData { + tplContent = strings.ReplaceAll(tplContent, "{"+k+"}", v) + } + return m.BaseSend(mailTo, subject, tplContent) +}