Style newsletters and system e-mails like www.eom.dev
Catppuccin Mocha campaign template (default) and archive variant, kept in sync in the database; system e-mail header/footer overridden via --static-dir from a ConfigMap. PNG logo for mail clients. Tested in Mailpit (desktop, phone width; 87% CSS support, rest inlined). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -168,6 +168,40 @@ WITH ur AS (
|
||||
SELECT count(*) FROM up;
|
||||
{% endfor %}
|
||||
|
||||
{#- Campaign templates (templates/email/campaign.html.j2): created by name,
|
||||
body kept in sync, and the main one is the default for new campaigns. #}
|
||||
{%- set email_templates = [
|
||||
(listmonk_email_template_name, lookup('ansible.builtin.template', 'email/campaign.html.j2', template_vars={'archive': false})),
|
||||
(listmonk_email_archive_template_name, lookup('ansible.builtin.template', 'email/campaign.html.j2', template_vars={'archive': true})),
|
||||
] %}
|
||||
{% for name, body in email_templates %}
|
||||
WITH ins AS (
|
||||
INSERT INTO templates (name, type, subject, body)
|
||||
SELECT {{ q(name) }}, 'campaign', '{{ '{{' }} .Campaign.Subject {{ '}}' }}', {{ q(body) }}
|
||||
WHERE NOT EXISTS (SELECT 1 FROM templates WHERE name = {{ q(name) }} AND type = 'campaign')
|
||||
RETURNING id
|
||||
)
|
||||
SELECT count(*) FROM ins;
|
||||
WITH upd AS (
|
||||
UPDATE templates SET body = {{ q(body) }}, updated_at = NOW()
|
||||
WHERE name = {{ q(name) }} AND type = 'campaign' AND body IS DISTINCT FROM {{ q(body) }}
|
||||
RETURNING id
|
||||
)
|
||||
SELECT count(*) FROM upd;
|
||||
{% endfor %}
|
||||
WITH unset AS (
|
||||
UPDATE templates SET is_default = false
|
||||
WHERE is_default AND NOT (name = {{ q(listmonk_email_template_name) }} AND type = 'campaign')
|
||||
RETURNING id
|
||||
)
|
||||
SELECT count(*) FROM unset;
|
||||
WITH setd AS (
|
||||
UPDATE templates SET is_default = true
|
||||
WHERE id = (SELECT min(id) FROM templates WHERE name = {{ q(listmonk_email_template_name) }} AND type = 'campaign') AND NOT is_default
|
||||
RETURNING id
|
||||
)
|
||||
SELECT count(*) FROM setd;
|
||||
|
||||
{% if listmonk_remove_sample_data | bool %}
|
||||
WITH del AS (
|
||||
DELETE FROM campaigns
|
||||
|
||||
Reference in New Issue
Block a user