-
Notifications
You must be signed in to change notification settings - Fork 0
/
html-tmpl.html
64 lines (63 loc) · 2.2 KB
/
html-tmpl.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/[email protected]"></script>
<title>%v</title>
</head>
<body class="h-full w-full flex flex-col items-center justify-between p-8">
<div class="flex-grow flex items-center justify-center">
<div class="w-[1000px] border">
<div class="email-information bg-white p-4 border-b">
<p><span class="font-bold">From:</span> %v </p>
<p><span class="font-bold">To:</span> %v </p>
<p><span class="font-bold">Cc:</span> %v </p>
<p><span class="font-bold">Bcc:</span> %v </p>
<p><span class="font-bold">Subject:</span> %v</p>
{{range $i, $v := .Attachments}}
<p><span class="font-bold">Attachment: </span><a href="{{ $v.Path }}" class="underline text-blue-500" download="{{ $v.Path }}">{{ $v.Name }}</a></p>
{{end}}
</div>
<div>
<div class="px-2 py-1 border-b">
<div>
{{range $i, $v := .Bodies}}
{{ $type := "Text"}}
{{ $hiddenFrom := "HTML"}}
{{ if contains $v.ContentType "html" }}
{{ $type = "HTML"}}
{{ $hiddenFrom = "Text"}}
{{end}}
<button id="{{$type}}Button" class="hover:bg-gray-100 rounded-lg px-2 py-1 {{if eq $i 0}}bg-gray-100{{end}}"
_="on click add .hidden to #{{$hiddenFrom}} end
on click remove .hidden from #{{$type}} end
on click add .bg-gray-100 to #{{$type}}Button end
on click remove .bg-gray-100 from #{{$hiddenFrom}}Button end">
{{$type}}
</button>
{{end}}
</div>
</div>
{{range $i, $v := .Bodies}}
{{ $type := "Text"}}
{{ $hiddenFrom := "HTML"}}
{{ if contains $v.ContentType "html" }}
{{ $type = "HTML"}}
{{ $hiddenFrom = "Text"}}
{{end}}
<div id="{{$type}}" class="{{if eq $i 0}}block{{else}}hidden{{end}}">
{{ if eq $type "HTML"}}
<iframe class="w-full h-[650px]" srcdoc="{{ $v.Content }}"></iframe>
{{else}}
<p class="p-4">{{ $v.Content }}</p>
{{end}}
</div>
{{end}}
</div>
</div>
</div>
<p class="text-sm pt-4">Powered by Meilo</p>
</body>
</html>