diff --git a/app/api/notify/resend.py b/app/api/notify/resend.py index 80df88a..6ff63cf 100644 --- a/app/api/notify/resend.py +++ b/app/api/notify/resend.py @@ -39,6 +39,16 @@ def root() -> dict: "type": "string", "required": True, "description": "HTML content of the email." + }, + "cta_label": { + "type": "string", + "required": False, + "description": "Optional CTA button label. Defaults to 'Call To Action'." + }, + "cta_url": { + "type": "string", + "required": False, + "description": "Optional CTA URL. Defaults to the website base URL." } } } @@ -53,6 +63,8 @@ class EmailRequest(BaseModel): to: EmailStr subject: str html: str + cta_label: str | None = None + cta_url: str | None = None @router.post("/resend", status_code=status.HTTP_202_ACCEPTED) def send_email(request: EmailRequest): @@ -63,7 +75,12 @@ def send_email(request: EmailRequest): result = send_email_resend( to=request.to, subject=request.subject, - html=goldlabel_email(request.subject, request.html), + html=goldlabel_email( + request.subject, + request.html, + cta_label=request.cta_label or "Call To Action", + cta_url=request.cta_url or "https://goldlabel.pro", + ), ) if "error" in result: meta = make_meta("error", result["error"]) diff --git a/app/utils/email_templates/goldlabel.bak.py b/app/utils/email_templates/goldlabel.bak.py new file mode 100644 index 0000000..0f49e59 --- /dev/null +++ b/app/utils/email_templates/goldlabel.bak.py @@ -0,0 +1,130 @@ +"""Goldlabel branded HTML email template.""" + +_LOGO_URL = "https://goldlabel.pro/goldlabelpro/png/favicon.png" + +# Palette (dark theme used for the email chrome; body text stays readable on white clients) +_DARK_BG = "#364450" +_DARK_PAPER = "#364450" +_DARK_PRIMARY = "#ffd849" +_DARK_TEXT = "#ffffff" +_LIGHT_BG = "#eaf0f5" +_LIGHT_PAPER = "#EEF7FF" +_LIGHT_TEXT = "#000000" +_LIGHT_PRIMARY = "#364450" + + +def goldlabel_email(subject: str, body_html: str) -> str: + """Return a complete HTML email string with Goldlabel branding. + + Args: + subject: Used as the visible heading inside the email. + body_html: Inner HTML content placed in the message body area. + + Returns: + A self-contained HTML string ready to pass to send_email_resend(). + """ + return f""" + + + + + + + {subject} + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +""" diff --git a/app/utils/email_templates/goldlabel.py b/app/utils/email_templates/goldlabel.py index 0f49e59..a264a06 100644 --- a/app/utils/email_templates/goldlabel.py +++ b/app/utils/email_templates/goldlabel.py @@ -1,24 +1,31 @@ """Goldlabel branded HTML email template.""" _LOGO_URL = "https://goldlabel.pro/goldlabelpro/png/favicon.png" +_BASE_URL = "https://goldlabel.pro" # Palette (dark theme used for the email chrome; body text stays readable on white clients) _DARK_BG = "#364450" _DARK_PAPER = "#364450" _DARK_PRIMARY = "#ffd849" _DARK_TEXT = "#ffffff" -_LIGHT_BG = "#eaf0f5" -_LIGHT_PAPER = "#EEF7FF" +_LIGHT_PAPER = "#ffffff" _LIGHT_TEXT = "#000000" _LIGHT_PRIMARY = "#364450" -def goldlabel_email(subject: str, body_html: str) -> str: +def goldlabel_email( + subject: str, + body_html: str, + cta_label: str = "Call To Action", + cta_url: str = _BASE_URL, +) -> str: """Return a complete HTML email string with Goldlabel branding. Args: subject: Used as the visible heading inside the email. body_html: Inner HTML content placed in the message body area. + cta_label: Label rendered in the full-width call-to-action button. + cta_url: Destination URL for the call-to-action button. Returns: A self-contained HTML string ready to pass to send_email_resend(). @@ -40,18 +47,19 @@ def goldlabel_email(subject: str, body_html: str) -> str: /* ── Base ──────────────────────────────────────── */ body {{ margin: 0; padding: 0; - background-color: {_LIGHT_BG}; + background-color: #ffffff; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: {_LIGHT_TEXT}; }} /* ── Dark-mode overrides ───────────────────────── */ @media (prefers-color-scheme: dark) {{ - body, .email-wrapper {{ background-color: {_DARK_BG} !important; color: {_DARK_TEXT} !important; }} + body, .email-wrapper {{ background-color: #ffffff !important; color: {_DARK_TEXT} !important; }} .email-card {{ background-color: {_DARK_PAPER} !important; color: {_DARK_TEXT} !important; }} - .email-header {{ background-color: {_DARK_BG} !important; }} + .email-header-inner {{ background-color: {_DARK_BG} !important; }} .email-footer {{ background-color: {_DARK_BG} !important; color: {_DARK_TEXT} !important; }} .email-subject {{ color: {_DARK_PRIMARY} !important; }} + .email-cta {{ background-color: {_DARK_PRIMARY} !important; color: {_DARK_BG} !important; }} a {{ color: {_DARK_PRIMARY} !important; }} }} @@ -59,64 +67,78 @@ def goldlabel_email(subject: str, body_html: str) -> str: + style="padding: 0;">
+ border-radius:6px; overflow:hidden; + box-shadow:none;"> - - - - - - - + - +