Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

fix(backend): finish transactional email client compatibility (#15219)

Toran Bruce Richards6c0680b92e75
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index cff8380fa0..b67b378a5a 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -11,7 +11,7 @@ repos:
hooks:
- id: check-added-large-files
args: ["--maxkb=500"]
- exclude: ^autogpt_platform/frontend/public/(autogpt-characters/v1\.1/expert-(maria|mina)/neutral/1024\.png|videos/workflows-moved\.mp4)$
+ exclude: ^autogpt_platform/frontend/public/(autogpt-characters/v1\.1/(expert-(maria|mina)/neutral|otto/neutral-transparent)/1024\.png|videos/workflows-moved\.mp4)$
- id: fix-byte-order-marker
- id: check-case-conflict
- id: check-merge-conflict
diff --git a/autogpt_platform/backend/backend/notifications/design_system_test.py b/autogpt_platform/backend/backend/notifications/design_system_test.py
index 05ce9ecc57..18b8b1d15f 100644
--- a/autogpt_platform/backend/backend/notifications/design_system_test.py
+++ b/autogpt_platform/backend/backend/notifications/design_system_test.py
@@ -17,7 +17,7 @@ from backend.notifications.design_system_fixtures import URLS, EmailScenario, sc
from backend.notifications.renderer import RenderedEmail, render
SCENARIOS = scenarios()
-OTTO_PATH = "/autogpt-characters/v1.1/otto/neutral/256.png"
+OTTO_PATH = "/autogpt-characters/v1.1/otto/neutral-transparent/256.png"
ADDRESS = "3rd Floor, 1 Ashley Road, Altrincham, WA14 2DT, UK"
@@ -37,7 +37,12 @@ def test_every_transactional_variant_uses_the_shared_frame(rendered):
assert email.preheader and email.text
assert "Geist," in document.elements("body")[0]["style"]
assert "Geist+Mono" in email.html
- assert any(table.get("width") == "560" for table in document.elements("table"))
+ sheets = [
+ table for table in document.elements("table") if table.get("class") == "sheet"
+ ]
+ assert len(sheets) == 2
+ assert all(table["width"] == "100%" for table in sheets)
+ assert all("width:100%; max-width:560px" in table["style"] for table in sheets)
for table in document.elements("table"):
assert table.get("role") == "presentation"
assert table.get("bgcolor"), table
diff --git a/autogpt_platform/backend/backend/notifications/email_asset_test.py b/autogpt_platform/backend/backend/notifications/email_asset_test.py
new file mode 100644
index 0000000000..eafad1a50f
--- /dev/null
+++ b/autogpt_platform/backend/backend/notifications/email_asset_test.py
@@ -0,0 +1,36 @@
+"""Email artwork stays transparent when clients recolor the surrounding band."""
+
+from pathlib import Path
+
+import pytest
+from PIL import Image
+
+from backend.notifications.template_env import create_body_environment
+
+PUBLIC = Path(__file__).resolve().parents[3] / "frontend" / "public"
+OTTO_PATH = "/autogpt-characters/v1.1/otto/neutral-transparent"
+
+
[email protected]("size", [256, 512, 1024])
+def test_email_otto_exports_have_transparent_backgrounds(size):
+ path = PUBLIC / f"{OTTO_PATH.lstrip('/')}/{size}.png"
+ assert path.is_file()
+ with Image.open(path) as image:
+ assert image.format == "PNG"
+ assert image.size == (size, size)
+ assert "A" in image.getbands()
+ alpha = image.getchannel("A")
+ assert alpha.getextrema() == (0, 255)
+ assert all(
+ alpha.getpixel(point) == 0
+ for point in ((0, 0), (size - 1, 0), (0, size - 1), (size - 1, size - 1))
+ )
+
+
+def test_email_hero_default_uses_the_transparent_export():
+ environment = create_body_environment(autoescape=True)
+ html = environment.from_string(
+ '{% import "_email_ui.j2" as ui with context %}{{ ui.hero_otto() }}'
+ ).render()
+ assert f'src="https://platform.agpt.co{OTTO_PATH}/256.png"' in html
+ assert 'width="160" height="160"' in html
diff --git a/autogpt_platform/backend/backend/notifications/email_client_test.py b/autogpt_platform/backend/backend/notifications/email_client_test.py
new file mode 100644
index 0000000000..2442259fa6
--- /dev/null
+++ b/autogpt_platform/backend/backend/notifications/email_client_test.py
@@ -0,0 +1,135 @@
+"""Client compatibility contracts for the shared email components."""
+
+import re
+from html.parser import HTMLParser
+
+import pytest
+
+from backend.notifications.template_env import create_body_environment
+
+
+def kit_html() -> str:
+ return (
+ create_body_environment(autoescape=True)
+ .from_string(
+ """{% import '_email_ui.j2' as ui with context %}
+{{ ui.head_block('Client compatibility') }}
+{{ ui.page_open() }}{{ ui.masthead() }}{{ ui.sheet_open() }}
+{{ ui.strip_amber('Needs you') }}
+{{ ui.cta('Review your plan', 'https://example.com/billing') }}
+{{ ui.attention_card({'title': 'Reconnect Gmail', 'body': 'Your connection expired.',
+ 'cta_label': 'Reconnect', 'cta_url': 'https://example.com/connect'}) }}
+{{ ui.media_link('Watch', 'A short introduction', 'https://example.com/watch') }}
+{{ ui.sheet_close() }}{{ ui.page_close() }}
+{{ ui.legal_footer('Account notice', 'Preferences', 'https://example.com/settings') }}
+{{ ui.internal_footer('Internal notification') }}
+</td></tr></table>"""
+ )
+ .render(assets="https://example.com/email")
+ )
+
+
+def test_outlook_has_font_fallback_and_fixed_image_density(kit_html: str):
+ assert "<!--[if mso]>" in kit_html
+ assert "<o:PixelsPerInch>96</o:PixelsPerInch>" in kit_html
+ assert re.search(
+ r"body,\s*td,\s*div,\s*p,\s*a,\s*span\s*\{[^}]*font-family:\s*Arial",
+ kit_html,
+ )
+
+
+def test_frame_and_footers_keep_fluid_width_when_styles_are_stripped(kit_html: str):
+ document = EmailElements()
+ document.feed(re.sub(r"<style>.*?</style>", "", kit_html, flags=re.S))
+ sheets = [
+ attrs
+ for tag, attrs in document.elements
+ if tag == "table" and "sheet" in attrs.get("class", "").split()
+ ]
+ assert len(sheets) == 3
+ for sheet in sheets:
+ assert sheet["width"] == "100%"
+ assert "width:100%" in sheet["style"]
+ assert "max-width:560px" in sheet["style"]
+ assert len(re.findall(r'<!--\[if mso\]>.*?width="560"', kit_html, re.S)) == 3
+ assert kit_html.count("<!--[if mso]></td></tr></table><![endif]-->") == 3
+
+
+def test_phone_sheet_has_no_outer_side_padding_and_resets_all_corners(kit_html: str):
+ document = EmailElements()
+ document.feed(kit_html)
+ outer_cell = next(attrs for tag, attrs in document.elements if tag == "td")
+ assert "padding:32px 0 44px" in outer_cell["style"]
+ assert re.search(r"\.corner\s*\{\s*border-radius:0\s*!important;", kit_html)
+ rounded_sheet_elements = [
+ attrs
+ for _, attrs in document.elements
+ if "border-radius:16px 16px 0 0" in attrs.get("style", "")
+ or "border-radius:0 0 16px 16px" in attrs.get("style", "")
+ ]
+ assert len(rounded_sheet_elements) == 3
+ assert all("corner" in attrs["class"].split() for attrs in rounded_sheet_elements)
+
+
+def test_both_button_sizes_preserve_padding_in_outlook(kit_html: str):
+ document = EmailElements()
+ document.feed(kit_html)
+ buttons = [
+ attrs
+ for tag, attrs in document.elements
+ if tag == "td" and attrs.get("bgcolor") == "#6144DF"
+ ]
+ assert len(buttons) == 2
+ for button, padding in zip(buttons, ("13px 28px", "8px 14px")):
+ assert f"mso-padding-alt:{padding}" in button["style"]
+ classes = button["class"].split()
+ assert "email-button" in classes
+ assert ("email-button-small" in classes) == (padding == "8px 14px")
+
+
+def test_both_button_sizes_have_full_clickable_padding(kit_html: str):
+ document = EmailElements()
+ document.feed(kit_html)
+ buttons = [
+ (attrs, document.elements[index + 1])
+ for index, (tag, attrs) in enumerate(document.elements)
+ if tag == "td" and attrs.get("bgcolor") == "#6144DF"
+ ]
+ assert len(buttons) == 2
+ for (cell, (tag, link)), padding in zip(buttons, ("13px 28px", "8px 14px")):
+ assert tag == "a"
+ assert f"padding:{padding}" in link["style"]
+ assert "display:block" in link["style"]
+ assert not re.search(r"(?:^|;)\s*padding(?:-[a-z]+)?:", cell["style"])
+
+
+def test_outlook_padding_does_not_double_the_clickable_link_padding(kit_html: str):
+ outlook_head = re.search(r"<!--\[if mso\]>(.*?)<!\[endif\]-->", kit_html, re.S)
+ assert outlook_head is not None
+ styles = outlook_head.group(1)
+ assert re.search(r"\.email-button\s*\{\s*padding:13px 28px !important;", styles)
+ assert re.search(
+ r"\.email-button-small\s*\{\s*padding:8px 14px !important;", styles
+ )
+ assert re.search(r"\.email-button a\s*\{\s*padding:0 !important;", styles)
+
+
+def test_triangle_and_play_symbols_request_text_presentation(kit_html: str):
+ document = EmailElements()
+ document.feed(kit_html)
+ assert document.text.count("▲\ufe0e") == 2
+ assert document.text.count("▶\ufe0e") == 1
+
+
+class EmailElements(HTMLParser):
+ def __init__(self):
+ super().__init__(convert_charrefs=True)
+ self.elements: list[tuple[str, dict[str, str]]] = []
+ self.text = ""
+
+ def handle_starttag(self, tag: str, attrs: list[tuple[str, str | None]]):
+ self.elements.append((tag, {key: value or "" for key, value in attrs}))
+
+ def handle_data(self, data: str):
+ self.text += data
diff --git a/autogpt_platform/backend/backend/notifications/lifecycle_plan.py b/autogpt_platform/backend/backend/notifications/lifecycle_plan.py
index 182550ef39..c3add511a9 100644
--- a/autogpt_platform/backend/backend/notifications/lifecycle_plan.py
+++ b/autogpt_platform/backend/backend/notifications/lifecycle_plan.py
@@ -96,12 +96,16 @@ def format_amount(minor_units: int | None, currency: str) -> str:
aren't."""
if minor_units is None:
return "Not available"
- symbol = {"usd": "$", "eur": "€", "gbp": "£"}.get(currency.lower(), "")
+ symbol = currency_symbol(currency)
if currency.lower() in _ZERO_DECIMAL_CURRENCIES:
return f"{symbol}{minor_units:,}"
return f"{symbol}{minor_units / 100:,.2f}"
+def currency_symbol(currency: str) -> str:
+ return {"usd": "$", "eur": "€", "gbp": "£"}.get(currency.lower(), "")
+
+
def format_date(timestamp: int | None) -> str:
"""The one fact these emails exist to state, so it is never relative."""
if not timestamp:
diff --git a/autogpt_platform/backend/backend/notifications/lifecycle_plan_test.py b/autogpt_platform/backend/backend/notifications/lifecycle_plan_test.py
new file mode 100644
index 0000000000..335114c2cf
--- /dev/null
+++ b/autogpt_platform/backend/backend/notifications/lifecycle_plan_test.py
@@ -0,0 +1,19 @@
+import pytest
+
+from backend.notifications import lifecycle_plan
+
+
+ "currency,symbol,amount",
+ [
+ ("usd", "$", "$50.00"),
+ ("USD", "$", "$50.00"),
+ ("eur", "€", "€50.00"),
+ ("GBP", "£", "£50.00"),
+ ("cad", "", "50.00"),
+ ("jpy", "", "5,000"),
+ ],
+)
+def test_currency_symbol_matches_formatted_amount(currency, symbol, amount):
+ assert lifecycle_plan.currency_symbol(currency) == symbol
+ assert lifecycle_plan.format_amount(5000, currency) == amount
diff --git a/autogpt_platform/backend/backend/notifications/renderer.py b/autogpt_platform/backend/backend/notifications/renderer.py
index 0e1b39feee..bb1ed6b334 100644
--- a/autogpt_platform/backend/backend/notifications/renderer.py
+++ b/autogpt_platform/backend/backend/notifications/renderer.py
@@ -138,7 +138,7 @@ def _build_context(
asset_url = urlsplit(context["assets"])
context["otto_asset_url"] = (
f"{asset_url.scheme}://{asset_url.netloc}"
- "/autogpt-characters/v1.1/otto/neutral/256.png"
+ "/autogpt-characters/v1.1/otto/neutral-transparent/256.png"
)
if "plan" in context:
plan = context["plan"]
diff --git a/autogpt_platform/backend/backend/notifications/renderer_test.py b/autogpt_platform/backend/backend/notifications/renderer_test.py
index c5521b9456..4e4f5a3f71 100644
--- a/autogpt_platform/backend/backend/notifications/renderer_test.py
+++ b/autogpt_platform/backend/backend/notifications/renderer_test.py
@@ -369,7 +369,7 @@ def test_otto_uses_the_configured_image_host(monkeypatch):
)
assert 'src="https://assets.example/email/logo-light.png"' in email.html
assert (
- 'src="https://assets.example/autogpt-characters/v1.1/otto/neutral/256.png"'
+ 'src="https://assets.example/autogpt-characters/v1.1/otto/neutral-transparent/256.png"'
in email.html
)
diff --git a/autogpt_platform/backend/backend/notifications/templates/_email_ui.j2 b/autogpt_platform/backend/backend/notifications/templates/_email_ui.j2
index e3c2bd9e3d..3003d8d66d 100644
--- a/autogpt_platform/backend/backend/notifications/templates/_email_ui.j2
+++ b/autogpt_platform/backend/backend/notifications/templates/_email_ui.j2
@@ -15,7 +15,7 @@
{%- set FONT = "Geist, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" -%}
{%- set MONO = "'Geist Mono', ui-monospace, Menlo, Consolas, monospace" -%}
-{%- set OTTO = otto_asset_url | default("https://platform.agpt.co/autogpt-characters/v1.1/otto/neutral/256.png", true) -%}
+{%- set OTTO = otto_asset_url | default("https://platform.agpt.co/autogpt-characters/v1.1/otto/neutral-transparent/256.png", true) -%}
{%- macro head_block(title_text) -%}
<meta charset="utf-8">
@@ -23,6 +23,15 @@
<meta name="color-scheme" content="light">
<meta name="supported-color-schemes" content="light">
<title>{{ title_text }}</title>
+<!--[if mso]>
+<xml><o:OfficeDocumentSettings><o:PixelsPerInch>96</o:PixelsPerInch></o:OfficeDocumentSettings></xml>
+<style>
+ body, td, div, p, a, span { font-family: Arial, Helvetica, sans-serif !important; }
+ .email-button { padding:13px 28px !important; }
+ .email-button-small { padding:8px 14px !important; }
+ .email-button a { padding:0 !important; }
+</style>
+<![endif]-->
<style>
@import url('https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500&display=swap');
html, body { margin:0 !important; padding:0 !important; width:100% !important; }
@@ -30,6 +39,7 @@
a { text-decoration:none; }
@media only screen and (max-width: 600px) {
.sheet { width:100% !important; }
+ .corner { border-radius:0 !important; }
.gutter { padding-left:22px !important; padding-right:22px !important; }
.headline { font-size:23px !important; line-height:31px !important; }
.sum { font-size:10px !important; letter-spacing:0 !important; }
@@ -54,17 +64,19 @@
{%- macro page_open() -%}
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" bgcolor="#ECEAF6">
-<tr><td align="center" style="padding:32px 12px 44px;">
- <table role="presentation" width="560" cellpadding="0" cellspacing="0" border="0" bgcolor="#ECEAF6" class="sheet" style="width:560px; max-width:560px;">
+<tr><td align="center" class="paper" style="padding:32px 0 44px;">
+ <!--[if mso]><table role="presentation" width="560" cellpadding="0" cellspacing="0" border="0" bgcolor="#ECEAF6"><tr><td><![endif]-->
+ <table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" bgcolor="#ECEAF6" class="sheet" style="width:100%; max-width:560px;">
{%- endmacro -%}
{%- macro page_close() -%}
</table>
+ <!--[if mso]></td></tr></table><![endif]-->
{%- endmacro -%}
{# Masthead: ink band, the wordmark with the octopus eyes, 100x45. #}
{%- macro masthead() -%}
- <tr><td bgcolor="#171925" align="center" style="border-radius:16px 16px 0 0; padding:10px 0 8px; line-height:0;">
+ <tr><td bgcolor="#171925" align="center" class="corner" style="border-radius:16px 16px 0 0; padding:10px 0 8px; line-height:0;">
<a href="https://agpt.co" style="display:inline-block;"><img src="{{ assets | default('https://platform.agpt.co/email', true) }}/logo-light.png" width="100" height="45" alt="AutoGPT" style="display:block; border:0;"></a>
</td></tr>
{%- endmacro -%}
@@ -88,8 +100,8 @@
{# White sheet below the masthead/hero. Close with sheet_close(). #}
{%- macro sheet_open() -%}
- <tr><td bgcolor="#FFFFFF" style="border-radius:0 0 16px 16px;">
- <table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" bgcolor="#FFFFFF" style="border-collapse:separate; border-spacing:0; border-radius:0 0 16px 16px;">
+ <tr><td bgcolor="#FFFFFF" class="corner" style="border-radius:0 0 16px 16px;">
+ <table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" bgcolor="#FFFFFF" class="corner" style="border-collapse:separate; border-spacing:0; border-radius:0 0 16px 16px;">
{%- endmacro -%}
{%- macro sheet_close() -%}
</table>
@@ -98,7 +110,7 @@
{%- macro strip_amber(text) -%}
<tr><td bgcolor="#FFF6E8" class="gutter" style="padding:12px 48px; border-bottom:1px solid #F2DCB0;">
- <div style="font-size:12px; font-weight:700; letter-spacing:2px; color:#B45309;">&#9650;&nbsp; {{ text }}</div>
+ <div style="font-size:12px; font-weight:700; letter-spacing:2px; color:#B45309;">&#9650;&#xFE0E;&nbsp; {{ text }}</div>
</td></tr>
{%- endmacro -%}
@@ -179,17 +191,19 @@
{%- endif -%}
{%- endmacro -%}
+{# The link owns the full padded surface. MSO rules transfer padding to the
+ cell for Outlook without applying it twice. #}
{%- macro btn(label, url) -%}
<table role="presentation" cellpadding="0" cellspacing="0" border="0" bgcolor="#FFFFFF">
- <tr><td bgcolor="#6144DF" style="border-radius:8px;">
- <a href="{{ url }}" style="display:inline-block; padding:13px 28px; font-size:15px; line-height:20px; font-weight:600; color:#ffffff; font-family:{{ FONT }};">{{ label }}</a>
+ <tr><td bgcolor="#6144DF" align="center" class="email-button" style="border-radius:8px; mso-padding-alt:13px 28px;">
+ <a href="{{ url }}" style="display:block; padding:13px 28px; font-size:15px; line-height:20px; font-weight:600; color:#ffffff; font-family:{{ FONT }};">{{ label }}</a>
</td></tr>
</table>
{%- endmacro -%}
{%- macro btn_small(label, url) -%}
- <table role="presentation" cellpadding="0" cellspacing="0" border="0" bgcolor="#FFF6E8"><tr><td bgcolor="#6144DF" style="border-radius:6px;">
- <a href="{{ url }}" style="display:inline-block; padding:8px 14px; font-size:13px; line-height:18px; font-weight:600; color:#ffffff; font-family:{{ FONT }};">{{ label }}</a>
+ <table role="presentation" cellpadding="0" cellspacing="0" border="0" bgcolor="#FFF6E8"><tr><td bgcolor="#6144DF" align="center" class="email-button email-button-small" style="border-radius:6px; mso-padding-alt:8px 14px;">
+ <a href="{{ url }}" style="display:block; padding:8px 14px; font-size:13px; line-height:18px; font-weight:600; color:#ffffff; font-family:{{ FONT }};">{{ label }}</a>
</td></tr></table>
{%- endmacro -%}
@@ -208,7 +222,7 @@
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" bgcolor="#FFF6E8" style="border-collapse:separate; border-spacing:0; border:1px solid #F2DCB0; border-left:4px solid {{ '#E8940A' if primary else '#F0CF9A' }}; border-radius:10px;">
<tr><td style="padding:16px 18px;">
<div style="font-size:15px; font-weight:700; color:#171925;">
- <span style="color:#B45309;">&#9650;</span>&nbsp; {{ trunc(item.title, 52) }}{% if item.tag %} &nbsp;<span style="font-size:11px; font-weight:700; letter-spacing:1px; color:#B45309; white-space:nowrap;">{{ item.tag|upper }}</span>{% endif %}
+ <span style="color:#B45309;">&#9650;&#xFE0E;</span>&nbsp; {{ trunc(item.title, 52) }}{% if item.tag %} &nbsp;<span style="font-size:11px; font-weight:700; letter-spacing:1px; color:#B45309; white-space:nowrap;">{{ item.tag|upper }}</span>{% endif %}
</div>
{% if item.body %}<div style="padding-top:5px; font-size:14px; line-height:21px; color:#2D2A3E;">{{ item.body }}</div>{% endif %}
<div style="padding-top:11px;">{% if primary %}{{ btn_small(item.cta_label, item.cta_url) }}{% else %}<a href="{{ item.cta_url }}" style="color:#6144DF; font-weight:600; text-decoration:underline;">{{ item.cta_label }}</a>{% endif %}</div>
@@ -288,7 +302,7 @@
<tr><td class="gutter" style="padding:{{ top }}px 48px 0;">
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" bgcolor="#F5F3FC" style="border-radius:10px;">
<tr><td style="padding:13px 16px;">
- <div style="font-size:14px; font-weight:700;"><a href="{{ url }}" style="color:#6144DF; text-decoration:underline;">&#9654;&nbsp; {{ label }}</a></div>
+ <div style="font-size:14px; font-weight:700;"><a href="{{ url }}" style="color:#6144DF; text-decoration:underline;">&#9654;&#xFE0E;&nbsp; {{ label }}</a></div>
<div style="font-size:13px; line-height:20px; color:#575072; padding-top:2px;">{{ sub }}</div>
</td></tr>
</table>
@@ -365,7 +379,8 @@
{# Shared legal footer: registered address, a supplied link, and optional Discord. #}
{%- macro legal_footer(first_line, link_label, link_url, discord=false) -%}
- <table role="presentation" width="560" cellpadding="0" cellspacing="0" border="0" bgcolor="#ECEAF6" class="sheet" style="width:560px; max-width:560px;">
+ <!--[if mso]><table role="presentation" width="560" cellpadding="0" cellspacing="0" border="0" bgcolor="#ECEAF6"><tr><td><![endif]-->
+ <table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" bgcolor="#ECEAF6" class="sheet" style="width:100%; max-width:560px;">
<tr><td align="center" style="padding:18px 24px 0; font-size:11px; line-height:18px; color:#575072;">
{{ first_line }}<br>
{{ _address() }} &nbsp;&middot;&nbsp;
@@ -373,6 +388,7 @@
<a href="{{ urls.discord | default('https://discord.gg/autogpt', true) }}" style="color:#575072; text-decoration:underline;">Discord</a>{% endif %}
</td></tr>
</table>
+ <!--[if mso]></td></tr></table><![endif]-->
{%- endmacro -%}
{# Product (Briefing/Alert/Verdict): one-click unsubscribe link matching the
@@ -383,9 +399,11 @@
{# Internal: no marketing chrome, no unsubscribe. #}
{%- macro internal_footer(line) -%}
- <table role="presentation" width="560" cellpadding="0" cellspacing="0" border="0" bgcolor="#ECEAF6" class="sheet" style="width:560px; max-width:560px;">
+ <!--[if mso]><table role="presentation" width="560" cellpadding="0" cellspacing="0" border="0" bgcolor="#ECEAF6"><tr><td><![endif]-->
+ <table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" bgcolor="#ECEAF6" class="sheet" style="width:100%; max-width:560px;">
<tr><td align="center" style="padding:18px 24px 0; font-size:11px; line-height:18px; color:#575072;">
{{ line }}<br>AutoGPT, 3rd Floor, 1 Ashley Road, Altrincham, WA14 2DT, UK
</td></tr>
</table>
+ <!--[if mso]></td></tr></table><![endif]-->
{%- endmacro -%}
diff --git a/autogpt_platform/backend/backend/notifications/templates/alert.html.j2 b/autogpt_platform/backend/backend/notifications/templates/alert.html.j2
index 4beaf2f51d..d8fdaf5cfb 100644
--- a/autogpt_platform/backend/backend/notifications/templates/alert.html.j2
+++ b/autogpt_platform/backend/backend/notifications/templates/alert.html.j2
@@ -1,7 +1,7 @@
{%- import "_email_ui.j2" as ui with context -%}
{%- set also_items = also | default([]) -%}
<!doctype html>
-<html lang="en">
+<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>{{ ui.head_block(subject) }}</head>
{{ ui.body_open() }}
{{ ui.preheader(preheader) }}
diff --git a/autogpt_platform/backend/backend/notifications/templates/auth.html.j2 b/autogpt_platform/backend/backend/notifications/templates/auth.html.j2
index 9ab74f6acd..65efc6ce97 100644
--- a/autogpt_platform/backend/backend/notifications/templates/auth.html.j2
+++ b/autogpt_platform/backend/backend/notifications/templates/auth.html.j2
@@ -1,6 +1,6 @@
{% import '_email_ui.j2' as ui with context %}
<!doctype html>
-<html lang="en">
+<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>{{ ui.head_block(content.subject) }}</head>
{{ ui.body_open() }}
{{ ui.preheader(content.preheader) }}
diff --git a/autogpt_platform/backend/backend/notifications/templates/briefing.html.j2 b/autogpt_platform/backend/backend/notifications/templates/briefing.html.j2
index 44284bf2aa..bd1dad3911 100644
--- a/autogpt_platform/backend/backend/notifications/templates/briefing.html.j2
+++ b/autogpt_platform/backend/backend/notifications/templates/briefing.html.j2
@@ -3,7 +3,7 @@
{%- set attn = attention | default([]) -%}
{%- set failed = totals.failed | default(0) -%}
<!doctype html>
-<html lang="en">
+<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>{{ ui.head_block(subject) }}</head>
{{ ui.body_open() }}
{{ ui.preheader(preheader) }}
diff --git a/autogpt_platform/backend/backend/notifications/templates/changelog.html.j2 b/autogpt_platform/backend/backend/notifications/templates/changelog.html.j2
index 83f8d972fc..81444d5b16 100644
--- a/autogpt_platform/backend/backend/notifications/templates/changelog.html.j2
+++ b/autogpt_platform/backend/backend/notifications/templates/changelog.html.j2
@@ -12,7 +12,7 @@
============================================================ -#}
{%- import "_email_ui.j2" as ui with context -%}
<!doctype html>
-<html lang="en">
+<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>
{{ ui.head_block(subject) }}
</head>
@@ -21,7 +21,7 @@
{{ ui.page_open() }}
{{ ui.masthead() }}
{{ ui.hero('changelog') }}
- <tr><td bgcolor="#ffffff" style="border-radius:0 0 16px 16px;">
+ <tr><td bgcolor="#ffffff" class="corner" style="border-radius:0 0 16px 16px;">
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" bgcolor="#FFFFFF">
{% call ui.eyebrow(tone='brand') %}AUTOGPT UPDATE · {{ edition_label | upper }}{% endcall %}
{% call ui.headline() %}What's new: {{ period_label }}{% endcall %}
diff --git a/autogpt_platform/backend/backend/notifications/templates/lifecycle.html.j2 b/autogpt_platform/backend/backend/notifications/templates/lifecycle.html.j2
index 07d9675c3e..71b7a60af3 100644
--- a/autogpt_platform/backend/backend/notifications/templates/lifecycle.html.j2
+++ b/autogpt_platform/backend/backend/notifications/templates/lifecycle.html.j2
@@ -1,6 +1,6 @@
{%- import "_email_ui.j2" as ui with context -%}
<!doctype html>
-<html lang="en">
+<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>{{ ui.head_block(subject) }}</head>
{{ ui.body_open() }}
{{ ui.preheader(preheader) }}
diff --git a/autogpt_platform/backend/backend/notifications/templates/onboarding.html.j2 b/autogpt_platform/backend/backend/notifications/templates/onboarding.html.j2
index 2e6af97977..e13a9fe44c 100644
--- a/autogpt_platform/backend/backend/notifications/templates/onboarding.html.j2
+++ b/autogpt_platform/backend/backend/notifications/templates/onboarding.html.j2
@@ -7,7 +7,7 @@
============================================================ -#}
{%- import "_email_ui.j2" as ui with context -%}
<!doctype html>
-<html lang="en">
+<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>
{{ ui.head_block(subject) }}
</head>
@@ -18,7 +18,7 @@
{%- set TOUR_HEROES = {1: 'tour_firstwin', 2: 'tour_fiveways', 3: 'tour_workspace',
4: 'tour_listening', 5: 'tour_shipping', 6: 'tour_directline'} -%}
{{ ui.hero(TOUR_HEROES[part]) }}
- <tr><td bgcolor="#ffffff" style="border-radius:0 0 16px 16px;">
+ <tr><td bgcolor="#ffffff" class="corner" style="border-radius:0 0 16px 16px;">
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" bgcolor="#FFFFFF">
{%- if part == 1 %}
{% call ui.eyebrow(tone='brand') %}PART 1 OF {{ of }} · GETTING STARTED{% endcall %}
diff --git a/autogpt_platform/backend/backend/notifications/templates/ops.html.j2 b/autogpt_platform/backend/backend/notifications/templates/ops.html.j2
index 3284ab9f33..e463e95627 100644
--- a/autogpt_platform/backend/backend/notifications/templates/ops.html.j2
+++ b/autogpt_platform/backend/backend/notifications/templates/ops.html.j2
@@ -3,7 +3,7 @@
{%- set amount_str = '$' ~ '{:,.2f}'.format(amount_cents / 100) -%}
{%- set balance_str = '$' ~ '{:,.2f}'.format(balance_cents / 100) -%}
<!doctype html>
-<html lang="en">
+<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>{{ ui.head_block(subject) }}</head>
{{ ui.body_open() }}
{{ ui.preheader(preheader) }}
diff --git a/autogpt_platform/backend/backend/notifications/templates/trial.html.j2 b/autogpt_platform/backend/backend/notifications/templates/trial.html.j2
index 438c0ab7f7..7249381db4 100644
--- a/autogpt_platform/backend/backend/notifications/templates/trial.html.j2
+++ b/autogpt_platform/backend/backend/notifications/templates/trial.html.j2
@@ -1,7 +1,7 @@
{%- import "_email_ui.j2" as ui with context -%}
{%- import "_trial_copy.j2" as copy with context -%}
<!doctype html>
-<html lang="en">
+<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>{{ ui.head_block(subject) }}</head>
{{ ui.body_open() }}
{{ ui.preheader(preheader) }}
diff --git a/autogpt_platform/backend/backend/notifications/templates/verdict.html.j2 b/autogpt_platform/backend/backend/notifications/templates/verdict.html.j2
index 854457969c..0038dd1e74 100644
--- a/autogpt_platform/backend/backend/notifications/templates/verdict.html.j2
+++ b/autogpt_platform/backend/backend/notifications/templates/verdict.html.j2
@@ -2,7 +2,7 @@
{%- set approved = outcome == 'approved' -%}
{%- set has_note = comments and comments | trim | length > 0 -%}
<!doctype html>
-<html lang="en">
+<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>{{ ui.head_block(subject) }}</head>
{{ ui.body_open() }}
{{ ui.preheader(preheader) }}
diff --git a/autogpt_platform/backend/backend/notifications/trial.py b/autogpt_platform/backend/backend/notifications/trial.py
index 2d02994772..836d5242bb 100644
--- a/autogpt_platform/backend/backend/notifications/trial.py
+++ b/autogpt_platform/backend/backend/notifications/trial.py
@@ -22,7 +22,7 @@ from backend.data.notifications import (
from backend.data.stripe_client import stripe_call, stripe_list_items
from backend.data.subscription_trial import TrialState
from backend.notifications.dedupe import claim_once, release_claim
-from backend.notifications.lifecycle_plan import format_amount
+from backend.notifications.lifecycle_plan import currency_symbol, format_amount
from backend.notifications.queue import queue_notification_async
from backend.notifications.trial_audience import (
join_paying_audience,
@@ -178,7 +178,7 @@ async def trial_notice_disposition(
if data.notice_key != trial_notice_key(trial, data.kind):
return "obsolete"
expected = trial_notice_data(trial, data.kind, data.user_name, current)
- if data.model_copy(update={"notice_key": None}) != expected:
+ if not _notice_matches_current_terms(data, expected, trial, current):
return "obsolete"
if trial.status != current.get("status") or trial.cancel_at_period_end != bool(
current.get("cancel_at_period_end")
@@ -187,6 +187,27 @@ async def trial_notice_disposition(
return "current" if _notice_applies(trial, data.kind, current) else "suppressed"
+def _notice_matches_current_terms(
+ data: TrialUpdateData, expected: TrialUpdateData, trial: TrialState, current: dict
+) -> bool:
+ # Transitional shim: remove once old-format queued notices drain, per the
+ # rollout plan in docs/engineering/transactional-email-design.md.
+ terms = notice_plan(trial, data.kind, current)
+ plan = data.plan.model_copy()
+ legacy_label = f"{expected.plan.name} — {expected.plan.cycle}"
+ legacy_amount = format_amount(terms.unit_amount, terms.currency)
+ legacy_price = (
+ f"{legacy_amount} {terms.currency.upper()} / {expected.plan.cycle_noun}"
+ )
+ # Accept only the old presentation of these same terms, so a deploy does
+ # not discard queued notices or conceal a changed amount, plan or end date.
+ if plan.label == legacy_label:
+ plan.label = expected.plan.label
+ if plan.price_display == legacy_price:
+ plan.price_display = expected.plan.price_display
+ return data.model_copy(update={"plan": plan, "notice_key": None}) == expected
+
+
def _owns_subscription(trial: TrialState, current: dict) -> bool:
metadata = current.get("metadata") or {}
return (
@@ -246,6 +267,9 @@ def trial_notice_data(
plan = notice_plan(trial, kind, current)
title = plan.tier.title()
cycle_noun = "month" if plan.cycle == "monthly" else "year"
+ amount = format_amount(plan.unit_amount, plan.currency)
+ if plan.unit_amount is not None and not currency_symbol(plan.currency):
+ amount = f"{amount} {plan.currency.upper()}"
return TrialUpdateData(
user_name=name,
kind=kind,
@@ -253,8 +277,8 @@ def trial_notice_data(
name=title,
cycle=plan.cycle,
cycle_noun=cycle_noun,
- label=f"{title} — {plan.cycle}",
- price_display=f"{format_amount(plan.unit_amount, plan.currency)} {plan.currency.upper()} / {cycle_noun}",
+ label=f"{title} · {plan.cycle}",
+ price_display=f"{amount} / {cycle_noun}",
),
ends_label=trial.ends_at.astimezone(UTC).strftime("%d %b %Y at %H:%M UTC"),
onboarding_credit_amount=trial.offer.onboarding_credit_amount,
diff --git a/autogpt_platform/backend/backend/notifications/trial_cancel_notice_test.py b/autogpt_platform/backend/backend/notifications/trial_cancel_notice_test.py
index c8067df447..1976c04948 100644
--- a/autogpt_platform/backend/backend/notifications/trial_cancel_notice_test.py
+++ b/autogpt_platform/backend/backend/notifications/trial_cancel_notice_test.py
@@ -37,7 +37,7 @@ def test_resumed_notice_copy_is_unchanged(trial, urls):
assert email.subject == "Your AutoGPT trial will continue into your plan"
assert email.preheader == (
"Your saved card will be charged for your Pro plan on "
- f"{data.ends_label} at $20.00 USD / month."
+ f"{data.ends_label} at $20.00 / month."
)
assert (
"Applicable tax may be added. Review your plan or cancel in billing "
diff --git a/autogpt_platform/backend/backend/notifications/trial_notice_freshness_test.py b/autogpt_platform/backend/backend/notifications/trial_notice_freshness_test.py
index 10ea1fc1b3..f9680e343d 100644
--- a/autogpt_platform/backend/backend/notifications/trial_notice_freshness_test.py
+++ b/autogpt_platform/backend/backend/notifications/trial_notice_freshness_test.py
@@ -124,6 +124,75 @@ async def test_current_notice_survives_authoritative_refresh(trial, kind, change
database.sync_subscription_from_stripe.assert_awaited_once_with(raw)
+ "plan_changes,data_changes,expected",
+ [
+ ({}, {}, "current"),
+ ({"label": "Pro · monthly"}, {}, "current"),
+ ({"price_display": "$20.00 / month"}, {}, "current"),
+ ({"price_display": "$30.00 USD / month"}, {}, "obsolete"),
+ (
+ {"cycle": "yearly", "cycle_noun": "year", "label": "Pro — yearly"},
+ {},
+ "obsolete",
+ ),
+ ({"name": "Max", "label": "Max — monthly"}, {}, "obsolete"),
+ ({}, {"ends_label": "Obsolete end date"}, "obsolete"),
+ ],
+)
+async def test_predeploy_trial_format_preserves_freshness_checks(
+ trial, plan_changes, data_changes, expected
+):
+ data = notices.trial_notice_data(trial, "started", "Sam")
+ data.notice_key = notices.trial_notice_key(trial, "started")
+ data.plan = data.plan.model_copy(
+ update={
+ "label": "Pro — monthly",
+ "price_display": "$20.00 USD / month",
+ **plan_changes,
+ }
+ )
+ data = data.model_copy(update=data_changes)
+ original = data.model_copy(deep=True)
+ database = MagicMock(
+ get_subscription_trial=AsyncMock(return_value=trial),
+ sync_subscription_from_stripe=AsyncMock(),
+ )
+ with (
+ patch.object(notices, "credit_db", return_value=database),
+ patch.object(
+ notices, "stripe_call", AsyncMock(return_value=subscription(trial))
+ ),
+ ):
+ assert await notices.trial_notice_disposition(trial.user_id, data) == expected
+ assert data == original
+
+
+ "currency,price", [("cad", "20.00 CAD / month"), ("jpy", "2,000 JPY / month")]
+)
+async def test_predeploy_trial_currency_code_remains_current(trial, currency, price):
+ trial.offer = trial.offer.model_copy(update={"currency": currency})
+ data = notices.trial_notice_data(trial, "started", "Sam")
+ data.notice_key = notices.trial_notice_key(trial, "started")
+ data.plan = data.plan.model_copy(
+ update={"label": "Pro — monthly", "price_display": price}
+ )
+ database = MagicMock(
+ get_subscription_trial=AsyncMock(return_value=trial),
+ sync_subscription_from_stripe=AsyncMock(),
+ )
+ with (
+ patch.object(notices, "credit_db", return_value=database),
+ patch.object(
+ notices, "stripe_call", AsyncMock(return_value=subscription(trial))
+ ),
+ ):
+ assert await notices.trial_notice_disposition(trial.user_id, data) == "current"
+
+
@pytest.mark.asyncio
async def test_unidentified_legacy_payload_cannot_bypass_freshness_check(trial):
data = notices.trial_notice_data(trial, "started", "Sam")
diff --git a/autogpt_platform/backend/backend/notifications/trial_plan_test.py b/autogpt_platform/backend/backend/notifications/trial_plan_test.py
index a94ff30a67..36e1a510d2 100644
--- a/autogpt_platform/backend/backend/notifications/trial_plan_test.py
+++ b/autogpt_platform/backend/backend/notifications/trial_plan_test.py
@@ -65,8 +65,8 @@ def test_a_conversion_onto_the_chosen_plan_is_announced_as_that_plan(converted):
data = notices.trial_notice_data(converted, "converted", "Sam", _switched())
assert data.plan.name == "Max"
- assert data.plan.label == "Max — monthly"
- assert data.plan.price_display == "$320.00 USD / month"
+ assert data.plan.label == "Max · monthly"
+ assert data.plan.price_display == "$320.00 / month"
def test_a_yearly_choice_is_announced_as_yearly(converted):
@@ -75,12 +75,33 @@ def test_a_yearly_choice_is_announced_as_yearly(converted):
assert (plan.tier, plan.cycle) == ("MAX", "yearly")
[email protected]("interval,noun", [("month", "month"), ("year", "year")])
+ "currency,unit_amount,amount",
+ [
+ ("cad", None, "Not available"),
+ ("usd", None, "Not available"),
+ ("cad", 0, "0.00 CAD"),
+ ],
+)
+def test_conversion_formats_missing_and_zero_amounts(
+ converted, interval, noun, currency, unit_amount, amount
+):
+ current = _switched(interval)
+ current["items"]["data"][0]["price"].update(
+ currency=currency, unit_amount=unit_amount
+ )
+ data = notices.trial_notice_data(converted, "converted", "Sam", current)
+
+ assert data.plan.price_display == f"{amount} / {noun}"
+
+
@pytest.mark.parametrize("kind", ["started", "canceled", "ended", "payment_failed"])
def test_other_notices_keep_the_accepted_terms(converted, kind):
data = notices.trial_notice_data(converted, kind, "Sam", _switched())
assert data.plan.name == "Pro"
- assert data.plan.price_display == "$50.00 USD / month"
+ assert data.plan.price_display == "$50.00 / month"
def test_a_conversion_on_the_accepted_price_keeps_its_terms(converted, subscription):
@@ -89,6 +110,40 @@ def test_a_conversion_on_the_accepted_price_keeps_its_terms(converted, subscript
assert data.plan.name == "Pro"
+ "label,price,expected",
+ [
+ ("Max · monthly", "$320.00 / month", "current"),
+ ("Max — monthly", "$320.00 / month", "current"),
+ ("Max · monthly", "$320.00 USD / month", "current"),
+ ("Max — monthly", "$320.00 USD / month", "current"),
+ ("Max — monthly", "$50.00 USD / month", "obsolete"),
+ ("Max — monthly", "$100.00 USD / month", "obsolete"),
+ ],
+)
+async def test_conversion_freshness_matches_only_the_current_plan(
+ converted, label, price, expected
+):
+ current = _switched()
+ data = notices.trial_notice_data(converted, "converted", "Sam", current)
+ data.notice_key = notices.trial_notice_key(converted, "converted")
+ data.plan = data.plan.model_copy(update={"label": label, "price_display": price})
+ original = data.model_copy(deep=True)
+ database = MagicMock(
+ get_subscription_trial=AsyncMock(return_value=converted),
+ sync_subscription_from_stripe=AsyncMock(),
+ )
+ with (
+ patch.object(notices, "credit_db", return_value=database),
+ patch.object(notices, "stripe_call", AsyncMock(return_value=current)),
+ ):
+ assert (
+ await notices.trial_notice_disposition(converted.user_id, data) == expected
+ )
+ assert data == original
+
+
@pytest.mark.asyncio
async def test_the_conversion_event_reports_the_chosen_plan(converted):
current = _switched()
diff --git a/autogpt_platform/backend/backend/notifications/trial_test.py b/autogpt_platform/backend/backend/notifications/trial_test.py
index 4cbb1c6bde..1194acae15 100644
--- a/autogpt_platform/backend/backend/notifications/trial_test.py
+++ b/autogpt_platform/backend/backend/notifications/trial_test.py
@@ -67,6 +67,33 @@ def urls() -> EmailUrls:
)
[email protected]("cycle,cycle_noun", [("monthly", "month"), ("yearly", "year")])
+ "currency,formatted_amount",
+ [
+ ("usd", "$20.00"),
+ ("eur", "€20.00"),
+ ("gbp", "£20.00"),
+ ("cad", "20.00 CAD"),
+ ("jpy", "2,000 JPY"),
+ ],
+)
+def test_trial_plan_uses_design_labels_and_unambiguous_prices(
+ trial, urls, cycle, cycle_noun, currency, formatted_amount
+):
+ trial.offer = trial.offer.model_copy(
+ update={"billing_cycle": cycle, "currency": currency}
+ )
+ data = notices.trial_notice_data(trial, "ending", "Sam")
+
+ assert data.plan.label == f"Pro · {cycle}"
+ assert data.plan.price_display == f"{formatted_amount} / {cycle_noun}"
+ email = render(NotificationType.TRIAL_UPDATE, data, "[email protected]", urls)
+ for body in (email.html, email.text):
+ assert data.plan.label in body
+ assert data.plan.price_display in body
+
+
@pytest.mark.parametrize(
"kind",
[
@@ -84,7 +111,7 @@ def test_all_trial_notices_render_exact_terms_and_billing_link(trial, urls, kind
email = render(NotificationType.TRIAL_UPDATE, data, "[email protected]", urls)
assert email.subject and email.preheader
for body in (email.html, email.text):
- assert "$20.00 USD / month" in body
+ assert "$20.00 / month" in body
assert data.ends_label in body
assert urls.billing in body
if kind == "payment_failed":
diff --git a/autogpt_platform/frontend/public/autogpt-characters/v1.1/otto/neutral-transparent/1024.png b/autogpt_platform/frontend/public/autogpt-characters/v1.1/otto/neutral-transparent/1024.png
new file mode 100644
index 0000000000..bde979bd95
Binary files /dev/null and b/autogpt_platform/frontend/public/autogpt-characters/v1.1/otto/neutral-transparent/1024.png differ
diff --git a/autogpt_platform/frontend/public/autogpt-characters/v1.1/otto/neutral-transparent/256.png b/autogpt_platform/frontend/public/autogpt-characters/v1.1/otto/neutral-transparent/256.png
new file mode 100644
index 0000000000..e02fcd2b8b
Binary files /dev/null and b/autogpt_platform/frontend/public/autogpt-characters/v1.1/otto/neutral-transparent/256.png differ
diff --git a/autogpt_platform/frontend/public/autogpt-characters/v1.1/otto/neutral-transparent/512.png b/autogpt_platform/frontend/public/autogpt-characters/v1.1/otto/neutral-transparent/512.png
new file mode 100644
index 0000000000..9bfa2c4f7a
Binary files /dev/null and b/autogpt_platform/frontend/public/autogpt-characters/v1.1/otto/neutral-transparent/512.png differ
diff --git a/docs/engineering/email-design/client-after-390-normal.png b/docs/engineering/email-design/client-after-390-normal.png
new file mode 100644
index 0000000000..8c59790da4
Binary files /dev/null and b/docs/engineering/email-design/client-after-390-normal.png differ
diff --git a/docs/engineering/email-design/client-after-390-style-off.png b/docs/engineering/email-design/client-after-390-style-off.png
new file mode 100644
index 0000000000..be0510c173
Binary files /dev/null and b/docs/engineering/email-design/client-after-390-style-off.png differ
diff --git a/docs/engineering/email-design/client-after-640-normal.png b/docs/engineering/email-design/client-after-640-normal.png
new file mode 100644
index 0000000000..1374ed4aca
Binary files /dev/null and b/docs/engineering/email-design/client-after-640-normal.png differ
diff --git a/docs/engineering/email-design/client-before-390-normal.png b/docs/engineering/email-design/client-before-390-normal.png
new file mode 100644
index 0000000000..d997904598
Binary files /dev/null and b/docs/engineering/email-design/client-before-390-normal.png differ
diff --git a/docs/engineering/email-design/client-before-390-style-off.png b/docs/engineering/email-design/client-before-390-style-off.png
new file mode 100644
index 0000000000..661ad37485
Binary files /dev/null and b/docs/engineering/email-design/client-before-390-style-off.png differ
diff --git a/docs/engineering/email-design/client-before-640-normal.png b/docs/engineering/email-design/client-before-640-normal.png
new file mode 100644
index 0000000000..3a175def32
Binary files /dev/null and b/docs/engineering/email-design/client-before-640-normal.png differ
diff --git a/docs/engineering/transactional-email-design.md b/docs/engineering/transactional-email-design.md
index c1571ecdd5..701ee7c519 100644
--- a/docs/engineering/transactional-email-design.md
+++ b/docs/engineering/transactional-email-design.md
@@ -14,7 +14,7 @@ payload; Postmark receives those bodies rather than a hosted template ID.
| Alert | Each cause, including coalesced alerts | Amber needs-you strip and primary attention card; secondary actions are text links |
| Verdict | Approved; changes requested with/without notes | State eyebrow; reviewer feedback preserved and escaped; one marketplace action |
| Ops | Refund request, refund processed | Internal amount band and compact Otto; admin action; no unsubscribe |
-| Auth | Verify email, reset password, confirm new email | Compact layout without hero; action button and complete fallback URL; HTML and text; original subjects and origin validation |
+| Auth | Verify email, set/reset password, confirm new email | Compact layout without hero; action button and complete fallback URL; HTML and text; original subjects and origin validation |
Organization invitations have no email sender yet. SMTP/Gmail workflow blocks
send user-authored content and are not platform transactional notices. The
@@ -26,9 +26,19 @@ publish content or settings to MailerLite.
`backend/notifications/templates/_email_ui.j2` is the shared kit. It defines the
560px sheet, 48px desktop/22px phone gutters, Geist with system fallbacks, purple
`#6144DF` actions, ink `#171925`, white sheet and lavender paper. Facts stack on
-phones. Each family owns its HTML, subject/preheader, and text templates. The
-preheader appears in the lede; supplied user names and feedback stay escaped,
-and customer-authored punctuation is preserved.
+phones. At 600px and below, the paper has no side padding and the sheet has
+square corners; content keeps its 22px gutters. The sheet is fluid even when a
+client strips the stylesheet. Button links own their full padded surface,
+including when styles are removed. MSO-only rules transfer that padding to
+table cells for Outlook without doubling it. Inline font stacks preserve
+the fallback appearance in Outlook; action glyphs request text
+presentation instead of emoji. Each family owns its HTML, subject/preheader,
+and text templates. The preheader appears in the lede; supplied user names and
+feedback stay escaped, and customer-authored punctuation is preserved.
+
+Plan labels use a middle dot (`Pro · monthly`). Trial prices use the same
+formatted amount as lifecycle emails, with a currency code retained when the
+formatter has no currency symbol (`20.00 CAD / month`, `2,000 JPY / year`).
One primary button is the default. Cancellation confirmation uses a billing
text link. A Briefing without an attention item uses highlight/run-history text
@@ -46,9 +56,17 @@ footer link and ops has no footer links.
`EMAIL_ASSET_BASE_URL` defaults to `https://platform.agpt.co/email`, containing
`logo-light.png` (790x356 served at 100x45). Otto uses the same URL origin plus
-`/autogpt-characters/v1.1/otto/neutral/256.png`, served at 160x160 or 80x80 for ops.
-Both files ship in the frontend public assets. A custom asset host must serve
-both paths publicly over HTTPS without cookies or authentication.
+`/autogpt-characters/v1.1/otto/neutral-transparent/256.png`, served at 160x160 or
+80x80 for ops. Its transparent background lets the surrounding hero band show
+through when a mail client recolors the message in dark mode. The original
+opaque export remains available for already-delivered messages. The 256px,
+512px and 1024px transparent exports come unchanged from the approved October 6
+design handoff.
+
+The logo and transparent Otto ship in the frontend public assets. A custom
+asset host must serve both paths publicly over HTTPS without cookies or
+authentication. Deploy the frontend/static assets before the backend renderer
+so the new image URL resolves as soon as templates start using it.
Images use hosted PNG URLs, explicit dimensions, and descriptive alt text.
There are no data URIs or inline SVGs. The same text, facts and action links
@@ -67,25 +85,74 @@ The auth RPC remains compatible across old and new API and notification-service
versions during deployment and rollback. The client sends named JSON fields;
an older service ignores the new `text_body` field and still sends the HTML,
while the new service accepts requests without that field. Plain text is
-included when both components use the new code. This change does not require
-a particular service deployment order.
+included when both components use the new code. The auth RPC itself does not
+require a particular service deployment order.
+
+The trial payload formatting change does require ordered rollout: deploy the
+frontend/static assets first, the notification service second, and the API
+producer last. The new notification service accepts both the exact old and new
+plan labels/prices while still rejecting changed trial terms. An older service
+would consider the new producer's formatting obsolete and drop the queued
+notice. For rollback, revert the producer first and drain new-format messages
+before reverting the notification service. Keep the published assets available.
+
+## Production configuration and reminder checks
+
+The repository's deployment workflows dispatch to the infrastructure repository;
+the defaults here do not prove the effective production values. Before rollout:
+
+- Set `POSTMARK_SENDER_EMAIL` to the existing Postmark-verified auth address with
+ its approved display name. Check the effective notification-service value;
+ `[email protected]` is only a repository placeholder. Do not invent a new
+ sending identity as part of a template deploy.
+- Set `[email protected]` and
+ `[email protected]` explicitly in deployment, and inspect
+ delivered message headers. Preserve the configured billing, product and ops
+ senders and the transactional Postmark stream.
+- Check that the new public Otto URL returns a PNG without authentication from
+ the configured asset host before deploying the notification service.
+
+To verify the trial-ending reminder, follow the delivery path in order:
+
+1. In the live Stripe account, confirm the enabled platform webhook endpoint
+ subscribes to `customer.subscription.trial_will_end`.
+2. Check the Stripe Dashboard's **Trial ending events** setting is three days.
+ Compare a recent event's creation time with its subscription's `trial_end`.
+ The code only sends an ending notice inside the final three days, while the
+ trial is active, the card is verified and cancellation is not scheduled.
+3. Check the endpoint's delivery result and backend processing. A successful
+ Stripe webhook response is not proof that an email was delivered.
+4. Check PostHog for `trial_ending`, the current event name, and
+ `subscription_trial_ending` for older deployments. This event records a
+ successful notification enqueue, not Postmark delivery.
+5. Check Postmark activity in the configured transactional stream for the
+ billing sender and subject beginning `Your AutoGPT trial ends on`, then check
+ the delivery result for the affected recipient.
+
+Stripe's [trial-ending webhook setting](https://docs.stripe.com/billing/subscriptions/trials)
+is separate from its [hosted reminder emails](https://docs.stripe.com/billing/subscriptions/trials/manage-trial-compliance),
+which are sent seven days before trial end. Keep the hosted reminder disabled
+when AutoGPT owns this message, so a seven-day trial does not receive a second
+reminder at signup.
## Validation
-Local validation: 258 focused tests pass. The browser audit covers 31 scenarios
-at two widths (62 renders), including images blocked, with 1,548 text contrast
-checks and no failures. Public production logo and Otto endpoints returned
-HTTP 200 with PNG content without authentication.
+The original migration passed 258 focused tests and a browser audit of 31
+scenarios at two widths (62 renders), including images blocked, with 1,548 text
+contrast checks and no failures. Those results and the screenshots below
+predate the transparent Otto and email-client compatibility follow-up.
The notification design fixtures cover each lifecycle/trial branch, welcome
feature cohorts, Briefing cadences/attention, coalesced alerts, verdicts, and
refunds. Tests check frame/tokens, safe images, CTA exceptions, size, footers,
-link parity and escaped feedback. Auth tests check all three actions, URL
+link parity and escaped feedback. Auth tests check all four actions, URL
escaping, origin restrictions, and plain-text delivery. Transport tests inspect
the actual Postmark request fields with the network client mocked.
-Browser rendering checks at 640px and 390px test image-on/image-off layout,
-horizontal overflow and WCAG AA contrast against the effective background.
+For changes to the shared kit, render at 640px, 390px and 360px with images on
+and off, with styles stripped, and with simulated dark backgrounds. Check
+horizontal overflow, text and button visibility, and contrast against the
+effective background.
Browser evidence is not an actual Gmail, Apple Mail or Outlook delivery test.
Before release, send staging samples to authorized test inboxes and inspect
light/dark mode, images off, plain text, button and fallback links, and signed
@@ -95,6 +162,30 @@ production configuration changed, or deployment performed by this PR.
## Review previews
+The client compatibility follow-up was checked across all 32 fixture/auth
+variants at 640px, 390px and 360px in five modes: normal, stylesheet removed,
+images blocked, dark preference, and simulated dark backgrounds (480 layout
+and asset checks). No case overflowed; the largest HTML was 16,204 bytes. The
+dark simulation checks the transparent artwork against recolored backgrounds;
+it does not reproduce a mail client's color algorithm or establish dark-mode
+text contrast. Real inbox validation remains part of the release checklist.
+
+Both button sizes also passed 60 browser clicks across the three widths with
+normal and stripped styles, including each padded edge. Previously, all 48
+edge clicks missed the link; only the 12 label-center clicks succeeded.
+
+The comparisons below use local checked-in assets and synthetic fixture data.
+Desktop remains 560px wide. Phones now use the viewport width, and the inline
+fluid layout still fits when the stylesheet is removed.
+
+| Scenario | Before follow-up | After follow-up |
+| --- | --- | --- |
+| Desktop, 640px | ![Before at 640px](email-design/client-before-640-normal.png) | ![After at 640px](email-design/client-after-640-normal.png) |
+| Phone, 390px | ![Before at 390px](email-design/client-before-390-normal.png) | ![After at 390px](email-design/client-after-390-normal.png) |
+| Phone, stylesheet removed | ![Before with styles removed](email-design/client-before-390-style-off.png) | ![After with styles removed](email-design/client-after-390-style-off.png) |
+
+### Original migration
+
These screenshots use synthetic data and the supplied production logo/Otto
assets. The before column is the original `dev` template; after is this shared
kit. Each comparison includes desktop (640px) and phone (390px) renderings.