Skip to content

BillionMail gives you open-source MailServer, NewsLetter, Email Marketing — fully self-hosted, dev-friendly, and free from monthly fees. Join the discord: https://discord.gg/asfXzBUhZr

Revamp unsubscribe email templates for enhanced design and user experience

lotk643b8cecc7eb
diff --git a/core/public/html/unsubscribe_new.html b/core/public/html/unsubscribe_new.html
index 4abfc515..85b3223c 100644
--- a/core/public/html/unsubscribe_new.html
+++ b/core/public/html/unsubscribe_new.html
@@ -3,263 +3,267 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <title>Unsubscribe</title>
+ <title>Unsubscribe Confirmation</title>
<style>
+ p {
+ margin: 0;
+ }
body {
- font-family: Arial, sans-serif;
- background-color: #f4f4f4;
- display: flex;
- justify-content: center;
- align-items: center;
- min-height: 100vh;
+ background: #f5f5f5;
margin: 0;
padding: 20px;
- box-sizing: border-box;
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
- .unsubscribe-container {
- background-color: #fff;
- padding: 40px;
- border-radius: 10px;
- box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
- width: 100%;
+ .container {
max-width: 500px;
+ margin: 40px auto;
+ background: white;
+ border-radius: 12px;
+ box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
+ overflow: hidden;
+ }
+ .header {
text-align: center;
+ padding: 40px 30px 30px;
+ background: linear-gradient(135deg, #fefce8, #fef3c7);
}
- h2 {
+ .confirm-icon {
+ width: 80px;
+ height: 80px;
+ background: linear-gradient(135deg, #f59e0b, #d97706);
+ border-radius: 50%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ margin: 0 auto;
+ box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
+ }
+ .content {
+ padding: 32px 40px;
+ text-align: center;
+ }
+ .content h2 {
+ margin-top: 0;
+ margin-bottom: 24px;
+ color: #1f2937;
font-size: 24px;
- margin-bottom: 20px;
- color: #444;
+ font-weight: 600;
}
- p {
- font-size: 16px;
- line-height: 1.6;
- margin-bottom: 20px;
- color: #666;
+ .content p {
+ margin-top: 12px;
+ color: #6b7280;
+ font-size: 14px;
+ line-height: 1.5;
}
- .email-info {
- background-color: #f8f9fa;
- padding: 15px;
- border-radius: 5px;
+ .content .warning {
+ color: #dc2626;
+ font-weight: 500;
margin: 20px 0;
- border-left: 4px solid #007bff;
}
- .buttons {
- margin: 30px 0;
+ .button-group {
+ display: flex;
+ gap: 16px;
+ justify-content: center;
+ margin-top: 32px;
}
- button {
+ .button {
+ display: inline-block;
padding: 12px 24px;
- background-color: #dc3545;
- color: white;
- border: none;
- border-radius: 5px;
- cursor: pointer;
+ text-decoration: none;
+ border-radius: 6px;
font-size: 16px;
- transition: background-color 0.3s ease;
- margin: 10px;
- min-width: 120px;
+ font-weight: 500;
+ transition: all 0.2s ease;
+ cursor: pointer;
+ border: none;
}
- button:hover {
- background-color: #c82333;
+ .button-confirm {
+ background: #dc2626;
+ color: white;
}
- button.cancel {
- background-color: #6c757d;
+ .button-confirm:hover {
+ background: #b91c1c;
}
- button.cancel:hover {
- background-color: #5a6268;
+ .button-cancel {
+ background: #f3f4f6;
+ color: #4b5563;
}
- .loading {
- display: none;
- align-items: center;
- justify-content: center;
- position: fixed;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- background-color: rgba(0, 0, 0, 0.5);
- z-index: 1000;
+ .button-cancel:hover {
+ background: #e5e7eb;
}
- .loading-content {
- background-color: white;
- padding: 30px;
- border-radius: 10px;
+ .footer {
text-align: center;
+ padding: 20px 30px 30px;
+ color: #9ca3af;
+ font-size: 12px;
+ background: #f9fafb;
+ border-top: 1px solid #f3f4f6;
}
- .spinner {
- border: 4px solid rgba(0, 0, 0, 0.1);
- border-left-color: #3498db;
- border-radius: 50%;
- width: 30px;
- height: 30px;
- margin: 0 auto 15px;
- animation: spin 1s linear infinite;
+ .footer a {
+ color: #9ca3af;
+ text-decoration: underline;
}
- @keyframes spin {
- to {
- transform: rotate(360deg);
- }
- }
- .message {
- margin: 20px 0;
- padding: 15px;
- border-radius: 5px;
- font-weight: bold;
- }
- .success {
- background-color: #d4edda;
- color: #155724;
- border: 1px solid #c3e6cb;
- }
- .error {
- background-color: #f8d7da;
- color: #721c24;
- border: 1px solid #f5c6cb;
+ .footer a:hover {
+ color: #6b7280;
}
</style>
</head>
<body>
- <div id="loading" class="loading">
- <div class="loading-content">
- <div class="spinner"></div>
- <p>Processing your request...</p>
+<div class="container">
+ <div class="header">
+ <div class="confirm-icon">
+ <svg t="1757409014232" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="12359" width="36" height="36">
+ <path
+ d="M500.382 0.006c-177.646 19.719-276.341 96.721-296.085 230.93-3.949 43.437 17.757 67.13 65.143 71.066 23.667 3.961 43.411-13.808 59.207-53.296 23.692-82.9 80.862-124.35 171.735-124.35 110.479 7.885 169.698 63.156 177.671 165.8 0 94.759-64.313 110.202-99.248 138.774-44.267 36.218-73.217 72.952-108.655 135.216-29.779 52.314-34.91 164.227-34.91 164.227 0 47.373 21.655 71.066 65.143 71.066 39.413 0 61.194-23.693 65.155-71.066 0 0 5.219-125.594 55.925-181.129 57.472-62.942 194.749-107.071 198.698-268.922C804.365 108.561 697.772 15.789 500.382 0.006zM500.382 859.162c-45.524 0-82.409 36.91-82.409 82.41 0 45.523 36.885 82.422 82.409 82.422s82.422-36.898 82.422-82.422c0-45.5-36.898-82.41-82.422-82.41z"
+ fill="#ffffff"
+ p-id="12360"
+ ></path>
+ </svg>
</div>
</div>
+ <div class="content">
+ <h2>Unsubscribe Confirmation</h2>
- <div class="unsubscribe-container" id="container">
- <div id="confirm-section">
- <h2>Unsubscribe Confirmation</h2>
- <p>Are you sure you want to unsubscribe from this mailing list?</p>
- <div class="email-info" id="email-info" style="display: none;">
- <strong>Email:</strong> <span id="user-email"></span><br>
- <strong>Group:</strong> <span id="group-name"></span>
- </div>
- <div class="buttons">
- <button onclick="confirmUnsubscribe()" id="unsubscribe-btn">Yes, Unsubscribe</button>
- <button class="cancel" onclick="window.close()">Cancel</button>
- </div>
- </div>
+ <p>Are you sure you want to unsubscribe from this mailing list?</p>
- <div id="message-area"></div>
+ <div class="button-group">
+ <button class="button button-confirm" id="unsubscribe-btn" onclick="confirmUnsubscribe()">Yes, Unsubscribe</button>
+ <button class="button button-cancel" onclick="window.close()">Cancel</button>
+ </div>
</div>
+ <div class="email-info" id="email-info" style="display: none">
+ <strong>Email:</strong> <span id="user-email"></span><br />
+ <strong>Group:</strong> <span id="group-name"></span>
+ </div>
+ <div class="footer">
+ <div>
+ <span>Powered by </span>
+ <a href="https://www.billionmail.com/" target="_blank">BillionMail</a>
+ </div>
+ </div>
+</div>
+<script>
+ let params = {};
+ let jwtClaims = null;
- <script>
- let params = {};
- let jwtClaims = null;
-
- // 显示成功消息
- function showSuccess(message, data) {
- // 构建成功页面的URL参数
- const successPageUrl = new URL('/unsubscribe_success.html', window.location.origin);
+ // 显示成功消息
+ function showSuccess(message, data) {
+ // 构建成功页面的URL参数
+ const successPageUrl = new URL('/unsubscribe_success.html', window.location.origin);
- // 添加基本参数
- if (data) {
- if (data.email) {
- successPageUrl.searchParams.set('email', data.email);
- }
- if (data.group_name) {
- successPageUrl.searchParams.set('group_name', data.group_name);
- }
- if (data.redirect_url) {
- successPageUrl.searchParams.set('redirect_url', data.redirect_url);
- successPageUrl.searchParams.set('redirect_delay', '3'); // 3秒后跳转
- }
+ // 添加基本参数
+ if (data) {
+ if (data.email) {
+ successPageUrl.searchParams.set('email', data.email);
}
-
- // 添加成功消息
- if (message) {
- successPageUrl.searchParams.set('message', message);
+ if (data.group_name) {
+ successPageUrl.searchParams.set('group_name', data.group_name);
}
-
- // 生成重新订阅链接(如果有组token)
- if (jwtClaims && jwtClaims.group_id) {
- const resubscribeUrl = `/subscribe_form.html?token=group_${jwtClaims.group_id}`;
- successPageUrl.searchParams.set('resubscribe_url', resubscribeUrl);
+ if (data.redirect_url) {
+ successPageUrl.searchParams.set('redirect_url', data.redirect_url);
+ successPageUrl.searchParams.set('redirect_delay', '3'); // 3秒后跳转
}
-
- // 直接跳转到成功页面
- window.location.href = successPageUrl.toString();
}
- // 显示错误消息
- function showError(message) {
- const messageArea = document.getElementById('message-area');
- messageArea.innerHTML = `<div class="message error">${message}</div>`;
+ // 添加成功消息
+ if (message) {
+ successPageUrl.searchParams.set('message', message);
}
- // 显示加载状态
- function showLoading(show = true) {
- document.getElementById('loading').style.display = show ? 'flex' : 'none';
+ // 生成重新订阅链接(如果有组token)
+ if (jwtClaims && jwtClaims.group_id) {
+ const resubscribeUrl = `/subscribe_form.html?token=group_${jwtClaims.group_id}`;
+ successPageUrl.searchParams.set('resubscribe_url', resubscribeUrl);
}
- // 获取URL参数
- function getQueryParams() {
- const urlParams = {};
- const queryString = window.location.search.substring(1);
- const regex = /([^&=]+)=([^&]*)/g;
- let m;
- while ((m = regex.exec(queryString))) {
- urlParams[decodeURIComponent(m[1])] = decodeURIComponent(m[2]);
- }
- return urlParams;
+ // 直接跳转到成功页面
+ window.location.href = successPageUrl.toString();
+ }
+
+ // 显示错误消息
+ function showError(message) {
+ window.alert(message);
+ }
+
+ // 显示加载状态
+ function showLoading(show = true) {
+ document.getElementById('loading').style.display = show ? 'flex' : 'none';
+ }
+
+ // 获取URL参数
+ function getQueryParams() {
+ const urlParams = {};
+ const queryString = window.location.search.substring(1);
+ const regex = /([^&=]+)=([^&]*)/g;
+ let m;
+ while ((m = regex.exec(queryString))) {
+ urlParams[decodeURIComponent(m[1])] = decodeURIComponent(m[2]);
}
+ return urlParams;
+ }
- // 解析JWT令牌(客户端简单解析,仅用于显示)
- function parseJWTPayload(token) {
- try {
- const base64Url = token.split('.')[1];
- const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');
- const jsonPayload = decodeURIComponent(atob(base64).split('').map(function(c) {
- return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
- }).join(''));
- return JSON.parse(jsonPayload);
- } catch (e) {
- return null;
- }
+ // 解析JWT令牌(客户端简单解析,仅用于显示)
+ function parseJWTPayload(token) {
+ try {
+ const base64Url = token.split('.')[1];
+ const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');
+ const jsonPayload = decodeURIComponent(
+ atob(base64)
+ .split('')
+ .map(function (c) {
+ return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
+ })
+ .join('')
+ );
+ return JSON.parse(jsonPayload);
+ } catch (e) {
+ return null;
}
+ }
- // 初始化页面
- window.onload = function () {
- params = getQueryParams();
+ // 初始化页面
+ window.onload = function () {
+ params = getQueryParams();
- if (!params.jwt) {
- showError('Invalid or missing authentication token');
- return;
- }
+ if (!params.jwt) {
+ showError('Invalid or missing authentication token');
+ return;
+ }
- // 尝试解析JWT显示用户信息
- jwtClaims = parseJWTPayload(params.jwt);
- if (jwtClaims && jwtClaims.email) {
- document.getElementById('user-email').textContent = jwtClaims.email;
- document.getElementById('email-info').style.display = 'block';
+ // 尝试解析JWT显示用户信息
+ jwtClaims = parseJWTPayload(params.jwt);
+ if (jwtClaims && jwtClaims.email) {
+ document.getElementById('user-email').textContent = jwtClaims.email;
+ // document.getElementById('email-info').style.display = 'block';
- // 如果能解析到组信息,可以显示组名(需要后端提供或从JWT中获取)
- if (jwtClaims.group_id) {
- document.getElementById('group-name').textContent = `Group ID: ${jwtClaims.group_id}`;
- }
+ // 如果能解析到组信息,可以显示组名(需要后端提供或从JWT中获取)
+ if (jwtClaims.group_id) {
+ document.getElementById('group-name').textContent = `Group ID: ${jwtClaims.group_id}`;
}
- };
+ }
+ };
- // 确认退订
- function confirmUnsubscribe() {
- if (!params.jwt) {
- showError('Invalid authentication token');
- return;
- }
+ // 确认退订
+ function confirmUnsubscribe() {
+ if (!params.jwt) {
+ showError('Invalid authentication token');
+ return;
+ }
- showLoading(true);
+ // showLoading(true);
- const requestData = {
- jwt: params.jwt
- };
+ const requestData = {
+ jwt: params.jwt,
+ };
- // 发送退订请求
- fetch('/api/unsubscribe_new', {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- },
- body: JSON.stringify(requestData),
- })
+ // 发送退订请求
+ fetch('/api/unsubscribe_new', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ body: JSON.stringify(requestData),
+ })
.then(response => response.json())
.then(data => {
if (data.success) {
@@ -272,9 +276,9 @@
showError('Error processing unsubscribe request: ' + err.message);
})
.finally(() => {
- showLoading(false);
+ // showLoading(false);
});
- }
- </script>
+ }
+</script>
</body>
</html>
diff --git a/core/public/html/unsubscribe_success.html b/core/public/html/unsubscribe_success.html
index 9b4b04dc..4d8f4109 100644
--- a/core/public/html/unsubscribe_success.html
+++ b/core/public/html/unsubscribe_success.html
@@ -5,218 +5,109 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Unsubscribe Successful</title>
<style>
+ p {
+ margin: 0;
+ }
body {
- font-family: Arial, sans-serif;
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
- display: flex;
- justify-content: center;
- align-items: center;
- min-height: 100vh;
+ background: #f5f5f5;
margin: 0;
padding: 20px;
- box-sizing: border-box;
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
- .success-container {
- background-color: #fff;
- padding: 40px;
- border-radius: 15px;
- box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
- width: 100%;
+ .container {
max-width: 500px;
+ margin: 40px auto;
+ background: white;
+ border-radius: 12px;
+ box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
+ overflow: hidden;
+ }
+ .header {
text-align: center;
+ padding: 40px 30px 30px;
+ background: linear-gradient(135deg, #ecfdf5, #d1fae5);
}
.success-icon {
width: 80px;
height: 80px;
- background-color: #28a745;
+ background: linear-gradient(135deg, #10b981, #059669);
border-radius: 50%;
- margin: 0 auto 30px;
display: flex;
align-items: center;
justify-content: center;
- font-size: 40px;
- color: white;
+ margin: 0 auto;
+ box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}
- h1 {
- font-size: 28px;
- margin-bottom: 20px;
- color: #333;
- font-weight: 600;
- }
- .email-info {
- background-color: #f8f9fa;
- padding: 20px;
- border-radius: 8px;
- margin: 25px 0;
- border-left: 4px solid #28a745;
- }
- .email-info strong {
- color: #28a745;
- }
- p {
- font-size: 16px;
- line-height: 1.6;
- margin-bottom: 20px;
- color: #666;
+ .content {
+ padding: 32px 40px;
+ text-align: center;
}
- .message-box {
- background-color: #d4edda;
- color: #155724;
- padding: 15px;
- border-radius: 5px;
- border: 1px solid #c3e6cb;
- margin: 20px 0;
+ .content h2 {
+ margin-top: 0;
+ margin-bottom: 32px;
+ color: #1f2937;
+ font-size: 24px;
+ font-weight: 600;
}
- .actions {
- margin-top: 30px;
+ .content p {
+ margin-top: 12px;
+ color: #6b7280;
+ font-size: 14px;
+ line-height: 1.5;
}
- .btn {
+ .button {
display: inline-block;
- padding: 12px 24px;
- background-color: #007bff;
+ background: #3b82f6;
color: white;
+ padding: 12px 24px;
text-decoration: none;
- border-radius: 5px;
- margin: 10px;
- transition: background-color 0.3s ease;
- border: none;
- cursor: pointer;
+ border-radius: 6px;
font-size: 16px;
+ font-weight: 500;
+ transition: background-color 0.2s ease;
+ margin-top: 16px;
}
- .btn:hover {
- background-color: #0056b3;
+ .button:hover {
+ background: #2563eb;
}
- .btn-secondary {
- background-color: #6c757d;
- }
- .btn-secondary:hover {
- background-color: #5a6268;
+ .footer {
+ text-align: center;
+ padding: 20px 30px 30px;
+ color: #9ca3af;
+ font-size: 12px;
+ background: #f9fafb;
+ border-top: 1px solid #f3f4f6;
}
- .footer-text {
- margin-top: 30px;
- font-size: 14px;
- color: #999;
+ .footer a {
+ color: #9ca3af;
+ text-decoration: underline;
}
- .countdown {
- font-weight: bold;
- color: #007bff;
+ .footer a:hover {
+ color: #6b7280;
}
</style>
</head>
<body>
- <div class="success-container">
+<div class="container">
+ <div class="header">
<div class="success-icon">
- ✓
- </div>
-
- <h1>Successfully Unsubscribed</h1>
-
- <div class="email-info" id="email-info" style="display: none;">
- <p><strong>Email:</strong> <span id="user-email"></span></p>
- <p><strong>Group:</strong> <span id="group-name"></span></p>
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white" width="40px" height="40px">
+ <path d="M0 0h24v24H0z" fill="none" />
+ <path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z" />
+ </svg>
</div>
-
- <div class="message-box" id="success-message">
- You have been successfully unsubscribed from our mailing list.
- </div>
-
- <p>We're sorry to see you go! You will no longer receive emails from this mailing list.</p>
-
- <p>If you have any questions or if this was done in error, please don't hesitate to contact our support team.</p>
-
- <div class="actions">
- <a href="#" class="btn" id="resubscribe-btn" style="display: none;">Resubscribe</a>
- <button class="btn btn-secondary" onclick="window.close()">Close</button>
- </div>
-
- <div class="footer-text">
- <p>Thank you for being part of our community.</p>
- <p id="redirect-message" style="display: none;">
- You will be redirected in <span class="countdown" id="countdown">5</span> seconds...
- </p>
+ </div>
+ <div class="content">
+ <h2>Successfully Unsubscribed</h2>
+ <p>You have been successfully unsubscribed from our mailing list.</p>
+ <p>Thank you for being part of our community.</p>
+ </div>
+ <div class="footer">
+ <div>
+ <span>Powered by </span>
+ <a href="https://www.billionmail.com/" target="_blank">BillionMail</a>
</div>
</div>
-
- <script>
- // 获取URL参数
- function getQueryParams() {
- const urlParams = {};
- const queryString = window.location.search.substring(1);
- const regex = /([^&=]+)=([^&]*)/g;
- let m;
- while ((m = regex.exec(queryString))) {
- urlParams[decodeURIComponent(m[1])] = decodeURIComponent(m[2]);
- }
- return urlParams;
- }
-
- // 显示用户信息
- function displayUserInfo(email, groupName) {
- if (email) {
- document.getElementById('user-email').textContent = email;
- document.getElementById('email-info').style.display = 'block';
- }
- if (groupName) {
- document.getElementById('group-name').textContent = groupName;
- }
- }
-
- // 显示重新订阅按钮
- function showResubscribeButton(resubscribeUrl) {
- if (resubscribeUrl) {
- const btn = document.getElementById('resubscribe-btn');
- btn.href = resubscribeUrl;
- btn.style.display = 'inline-block';
- }
- }
-
- // 自动重定向
- function startRedirect(redirectUrl, delay = 5) {
- if (!redirectUrl) return;
-
- const redirectMessage = document.getElementById('redirect-message');
- const countdownElement = document.getElementById('countdown');
-
- redirectMessage.style.display = 'block';
-
- let countdown = delay;
- const timer = setInterval(() => {
- countdown--;
- countdownElement.textContent = countdown;
-
- if (countdown <= 0) {
- clearInterval(timer);
- window.location.href = redirectUrl;
- }
- }, 1000);
- }
-
- // 初始化页面
- window.onload = function() {
- const params = getQueryParams();
-
- // 显示用户信息
- if (params.email) {
- displayUserInfo(params.email, params.group_name);
- }
-
- // 显示重新订阅按钮
- if (params.resubscribe_url) {
- showResubscribeButton(params.resubscribe_url);
- }
-
- // 显示自定义消息
- if (params.message) {
- document.getElementById('success-message').textContent = decodeURIComponent(params.message);
- }
-
- // 自动重定向
- if (params.redirect_url) {
- const delay = params.redirect_delay ? parseInt(params.redirect_delay) : 5;
- startRedirect(decodeURIComponent(params.redirect_url), delay);
- }
- };
- </script>
+</div>
</body>
</html>
-
diff --git a/core/template/default_unsubscribe_email/unsubscribe_email.html b/core/template/default_unsubscribe_email/unsubscribe_email.html
index ee4fc9c4..e2a433ea 100644
--- a/core/template/default_unsubscribe_email/unsubscribe_email.html
+++ b/core/template/default_unsubscribe_email/unsubscribe_email.html
@@ -57,7 +57,7 @@
}
.button {
display: inline-block;
- background: #3b82f6;
+ background: #20a53a;
color: white;
padding: 12px 24px;
text-decoration: none;
@@ -67,7 +67,7 @@
transition: background-color 0.2s ease;
}
.button:hover {
- background: #2563eb;
+ background: #18802a;
}
.footer {
text-align: center;