From 9100303a3bb46d9b7e5ec506e98f97fb6d5acc6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Sat, 14 Aug 2021 21:20:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=96=B0=E7=9A=84=E5=8F=91?= =?UTF-8?q?=E9=82=AE=E4=BB=B6=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mail/mail.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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) +}