-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.go
161 lines (154 loc) · 5.61 KB
/
template.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
package mail
// 验证码邮件内容
type CaptchaEmail struct {
Username string `json:"username"`
Code string `json:"code"`
}
type EmailContent struct {
Title string `json:"title"` // 标题
HeadBg string `json:"head_bg"` // 头部背景图
HeadTips string `json:"head_tips"` // 头部提示
DearUser string `json:"dear"` // 亲爱的用户
Content string `json:"content"` // 内容
ButtonTips string `json:"button_tips"` // 按钮提示
ButtonLink string `json:"button_url"` // 按钮链接
ContactUs string `json:"contact_us"` // 联系我们
ContactLink string `json:"contact_link"` // 联系链接
}
func NewEmailContent() *EmailContent {
return &EmailContent{
Title: "验证码邮件",
HeadBg: "",
HeadTips: "",
DearUser: "你好",
Content: "未填写的内容",
ButtonTips: "点击重置密码",
ButtonLink: "http://localhost:8888/blog",
ContactUs: "647166282@qq.com",
ContactLink: "http://localhost:8888/blog",
}
}
const TempSimpleCode = `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{.Title}}</title>
<style>
table,
thead,
tbody,
tfoot,
tr,
td {
padding: 0;
margin: 0;
border: 0;
border-spacing: 0px;
}
</style>
</head>
<body>
<div>
<table style="width:700px;margin:0 auto;border:1px solid #f0f0f0;background-color: #fff;">
<thead style='
background-size:contain;
background-image: url("{{.HeadBg}}");
'
>
<tr>
<td>
<div style="box-sizing: border-box; height:130px;padding-top: 77px;padding-left:36px;">
<img src="" alt="" style="display: inline-block;width:40px;">
</div>
<div style="box-sizing: border-box; width:260px;height:130px;padding-left:36px;"> <span
style="font-family: 'PingFang SC'; font-weight: 500; font-size: 16px; line-height: 22px; color: #007DFF;">
{{.HeadTips}}
</span>
</div>
</td>
</tr>
</thead>
<tbody>
<tr>
<td>
<div style="padding: 24px;">
<p style="
margin-top: 0;
margin-bottom: 16px;
font-style: normal;
font-weight: 600;
font-size: 14px;
line-height: 20px;
color: #222222;">
{{.DearUser}}
</p>
<p style="
margin-top: 0;
margin-bottom: 0;
font-style: normal;
font-weight: 600;
font-size: 14px;
line-height: 20px;
color: #222222;">
{{.Content}}
</p>
</div>
</td>
</tr>
<tr>
<td>
<div style="padding-top: 24px;padding-bottom:0;">
<a href=" {{.ButtonLink}}" style="text-decoration: none;">
<div style="
width: 160px;
height: 40px;
margin: 0 auto;
background: #128FFF;
border-radius: 8px;
cursor: pointer;
text-align: center;
line-height: 40px;
font-style: normal;
font-weight: 400;
font-size: 16px;
color:#fff;
"oncontextmenu="return false;">
{{.ButtonTips}}
</div>
</a>
</div>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<td>
<div style="
padding-top: 48px;
margin-bottom: 8px;
text-align: center;
font-style: normal;
font-weight: 400;
font-size: 12px;
line-height: 17px;
color: #BABABA;
">
<span>若您有任何问题,可随时通过 <a href="{{.ContactLink}}">{{.ContactUs}}</a> 联系我们。</span>
</div>
</td>
</tr>
</tfoot>
</table>
</div>
</body>
</html>
`
const TempForgetPassword = `
您的账号{{.Username}}正在重置密码,验证码为 {{.Code}},有效期15分钟!
`
const TempRegister = `
您好{{.Username}},欢迎注册我的博客平台。您的验证码为 {{.Code}},有效期15分钟!
`