forked from Rathore-Rajpal/gmail-sent-automations
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate-templates.sql
More file actions
267 lines (241 loc) Β· 13.2 KB
/
update-templates.sql
File metadata and controls
267 lines (241 loc) Β· 13.2 KB
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
-- Update existing templates with professional designs
-- Run this in your Supabase SQL Editor
-- First, let's check if the templates table exists and has data
SELECT * FROM public.templates;
-- Update the Welcome Email template
UPDATE public.templates
SET
name = 'Professional Welcome Email',
description = 'A modern, professional welcome email template with company branding',
html_content = '<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{subject}}</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: ''Segoe UI'', Tahoma, Geneva, Verdana, sans-serif; line-height: 1.6; color: #333; background-color: #f8f9fa; }
.email-container { max-width: 600px; margin: 0 auto; background-color: #ffffff; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); }
.header { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 40px 30px; text-align: center; }
.logo { font-size: 28px; font-weight: 700; margin-bottom: 10px; }
.tagline { font-size: 16px; opacity: 0.9; }
.content { padding: 40px 30px; }
.greeting { font-size: 24px; color: #2c3e50; margin-bottom: 20px; }
.main-text { font-size: 16px; color: #555; margin-bottom: 25px; }
.features { background-color: #f8f9fa; padding: 25px; border-radius: 8px; margin: 25px 0; }
.features h3 { color: #2c3e50; margin-bottom: 15px; }
.features ul { list-style: none; }
.features li { padding: 8px 0; color: #555; position: relative; padding-left: 25px; }
.features li:before { content: "β"; color: #27ae60; font-weight: bold; position: absolute; left: 0; }
.cta-section { text-align: center; margin: 30px 0; }
.cta-button { display: inline-block; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 15px 30px; text-decoration: none; border-radius: 25px; font-weight: 600; font-size: 16px; transition: transform 0.3s ease; }
.cta-button:hover { transform: translateY(-2px); }
.footer { background-color: #2c3e50; color: white; padding: 30px; text-align: center; }
.contact-info { margin-bottom: 20px; }
.contact-info p { margin: 5px 0; font-size: 14px; }
.social-links { margin: 20px 0; }
.social-links a { color: white; text-decoration: none; margin: 0 10px; font-size: 14px; }
.legal-links { border-top: 1px solid #34495e; padding-top: 20px; }
.legal-links a { color: #bdc3c7; text-decoration: none; margin: 0 10px; font-size: 12px; }
@media only screen and (max-width: 600px) {
.email-container { margin: 0; }
.header, .content, .footer { padding: 20px; }
.logo { font-size: 24px; }
}
</style>
</head>
<body>
<div class="email-container">
<div class="header">
<div class="logo">{{company_name}}</div>
<div class="tagline">Welcome to the Future</div>
</div>
<div class="content">
<h1 class="greeting">Welcome, {{first_name}}! π</h1>
<p class="main-text">
Thank you for choosing {{company_name}}. We''re thrilled to have you join our community of innovators and forward-thinkers.
</p>
<div class="features">
<h3>What You Can Expect:</h3>
<ul>
<li>Exclusive insights and industry updates</li>
<li>Premium content and resources</li>
<li>Early access to new features</li>
<li>Personalized recommendations</li>
</ul>
</div>
<p class="main-text">
We''re committed to providing you with the best experience possible. If you have any questions or need assistance, our support team is here to help.
</p>
<div class="cta-section">
<a href="https://example.com/dashboard" class="cta-button">Get Started Now</a>
</div>
<p class="main-text" style="text-align: center; margin-top: 30px;">
Best regards,<br>
<strong>The {{company_name}} Team</strong>
</p>
</div>
<div class="footer">
<div class="contact-info">
<p><strong>{{company_name}}</strong></p>
<p>{{company_address}}</p>
<p>π§ {{company_email}} | π {{company_phone}}</p>
</div>
<div class="social-links">
<a href="#">LinkedIn</a> | <a href="#">Twitter</a> | <a href="#">Facebook</a>
</div>
<div class="legal-links">
<a href="{{unsubscribe_url}}">Unsubscribe</a> |
<a href="{{preferences_url}}">Update Preferences</a> |
<a href="#">Privacy Policy</a>
</div>
</div>
</div>
</body>
</html>'
WHERE name = 'Welcome Email';
-- Update Newsletter template
UPDATE public.templates
SET
name = 'Modern Newsletter Template',
description = 'A contemporary newsletter template with multiple sections and modern design',
html_content = '<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{subject}}</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: ''Segoe UI'', Tahoma, Geneva, Verdana, sans-serif; line-height: 1.6; color: #333; background-color: #f8f9fa; }
.email-container { max-width: 600px; margin: 0 auto; background-color: #ffffff; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); }
.header { background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); color: white; padding: 40px 30px; text-align: center; }
.logo { font-size: 28px; font-weight: 700; margin-bottom: 10px; }
.issue-info { font-size: 16px; opacity: 0.9; }
.content { padding: 40px 30px; }
.greeting { font-size: 24px; color: #2c3e50; margin-bottom: 20px; }
.intro-text { font-size: 16px; color: #555; margin-bottom: 30px; }
.section { margin-bottom: 35px; }
.section-title { color: #11998e; font-size: 20px; margin-bottom: 15px; border-bottom: 2px solid #11998e; padding-bottom: 8px; }
.highlight-box { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); color: white; padding: 25px; border-radius: 10px; margin: 20px 0; }
.highlight-box h4 { margin-bottom: 10px; font-size: 18px; }
.tips-list { background-color: #f8f9fa; padding: 20px; border-radius: 8px; border-left: 4px solid #11998e; }
.tips-list ul { list-style: none; }
.tips-list li { padding: 8px 0; color: #555; position: relative; padding-left: 25px; }
.tips-list li:before { content: "π‘"; position: absolute; left: 0; }
.cta-button { display: inline-block; background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); color: white; padding: 15px 30px; text-decoration: none; border-radius: 25px; font-weight: 600; font-size: 16px; transition: transform 0.3s ease; }
.cta-button:hover { transform: translateY(-2px); }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 25px 0; }
.stat-box { background-color: #f8f9fa; padding: 20px; border-radius: 8px; text-align: center; }
.stat-number { font-size: 24px; font-weight: bold; color: #11998e; }
.stat-label { font-size: 14px; color: #666; margin-top: 5px; }
.footer { background-color: #2c3e50; color: white; padding: 30px; text-align: center; }
.contact-info { margin-bottom: 20px; }
.contact-info p { margin: 5px 0; font-size: 14px; }
.social-links { margin: 20px 0; }
.social-links a { color: white; text-decoration: none; margin: 0 10px; font-size: 14px; }
.legal-links { border-top: 1px solid #34495e; padding-top: 20px; }
.legal-links a { color: #bdc3c7; text-decoration: none; margin: 0 10px; font-size: 12px; }
@media only screen and (max-width: 600px) {
.email-container { margin: 0; }
.header, .content, .footer { padding: 20px; }
.logo { font-size: 24px; }
.stats-grid { grid-template-columns: 1fr; }
}
</style>
</head>
<body>
<div class="email-container">
<div class="header">
<div class="logo">{{company_name}}</div>
<div class="issue-info">Monthly Newsletter β’ {{subject}}</div>
</div>
<div class="content">
<h1 class="greeting">Hello {{first_name}}! π</h1>
<p class="intro-text">
Welcome to our monthly newsletter! We''ve curated the most exciting updates, insights, and opportunities just for you.
</p>
<div class="section">
<h2 class="section-title">π This Month''s Highlights</h2>
<div class="stats-grid">
<div class="stat-box">
<div class="stat-number">15%</div>
<div class="stat-label">Growth Increase</div>
</div>
<div class="stat-box">
<div class="stat-number">2.5K</div>
<div class="stat-label">New Members</div>
</div>
</div>
</div>
<div class="section">
<h2 class="section-title">π₯ Featured Story</h2>
<div class="highlight-box">
<h4>Breaking News: Major Platform Update</h4>
<p>We''ve completely redesigned our platform to provide you with an even better experience. New features include advanced analytics, improved collaboration tools, and enhanced security measures.</p>
<a href="https://example.com/update" class="cta-button" style="background: white; color: #f5576c;">Learn More</a>
</div>
</div>
<div class="section">
<h2 class="section-title">π‘ Pro Tips</h2>
<div class="tips-list">
<ul>
<li>Optimize your workflow with our new automation features</li>
<li>Join our upcoming webinar on "Advanced Strategies"</li>
<li>Connect with other members in our community forum</li>
<li>Download our latest resource guide for free</li>
</ul>
</div>
</div>
<div class="section">
<h2 class="section-title">π― Upcoming Events</h2>
<p style="margin-bottom: 20px;">Don''t miss these exciting opportunities to learn and grow with our community:</p>
<ul style="list-style: none; margin-bottom: 20px;">
<li style="padding: 10px 0; border-bottom: 1px solid #eee;">π
<strong>Webinar:</strong> "Future of Digital Marketing" - Next Tuesday</li>
<li style="padding: 10px 0; border-bottom: 1px solid #eee;">πͺ <strong>Conference:</strong> Annual Tech Summit - March 15-17</li>
<li style="padding: 10px 0;">π <strong>Contest:</strong> Innovation Challenge - Submit by March 30</li>
</ul>
<div style="text-align: center;">
<a href="https://example.com/events" class="cta-button">View All Events</a>
</div>
</div>
<p style="text-align: center; margin-top: 40px; color: #666;">
Thank you for being part of our amazing community!<br>
<strong>The {{company_name}} Team</strong>
</p>
</div>
<div class="footer">
<div class="contact-info">
<p><strong>{{company_name}}</strong></p>
<p>{{company_address}}</p>
<p>π§ {{company_email}} | π {{company_phone}}</p>
</div>
<div class="social-links">
<a href="#">LinkedIn</a> | <a href="#">Twitter</a> | <a href="#">Facebook</a> | <a href="#">Instagram</a>
</div>
<div class="legal-links">
<a href="{{unsubscribe_url}}">Unsubscribe</a> |
<a href="{{preferences_url}}">Update Preferences</a> |
<a href="#">Privacy Policy</a> |
<a href="#">Terms of Service</a>
</div>
</div>
</div>
</body>
</html>'
WHERE name = 'Newsletter Template';
-- Also update the RLS policies to allow reading default templates
DROP POLICY IF EXISTS "Users can manage their own templates" ON public.templates;
DROP POLICY IF EXISTS "Users can read default templates" ON public.templates;
CREATE POLICY "Users can manage their own templates"
ON public.templates
FOR ALL
USING (auth.uid() = user_id OR is_default = true)
WITH CHECK (auth.uid() = user_id);
CREATE POLICY "Users can read default templates"
ON public.templates
FOR SELECT
USING (is_default = true);
-- Verify the updates
SELECT id, name, description, is_default FROM public.templates ORDER BY created_at;