私の場合は非常に単純です。
- テキスト/プレーンメールのテンプレートがあります: body.txt
- text/html メール用の別のもの: body.html
私は EmailAlternative を使用して両方を同じメールで送信しているため、この 2 つのメールの内容は同じです。
body.txt :
{% block message %}{% endblock %}
{{ site_name }} team
-----------------
If you need help contact use at {{ support_mail }}
body.html :
<html>
<head>
<title>{% block title %}{% endblock %}</title>
</head>
<body>
<p>{% filter linebreaksbr %}{% block message %}{% endblock %}{% endfilter %}</p>
<p><strong>{{ site_name }} team</strong></p>
<hr/>
If you need help contact use at <a href="mailto:{{ support_mail }}">{{ support_mail }}</a>
</body>
</html>
もちろん、翻訳、css、および複数のブロックを使用すると、もう少し複雑になります。
私の願いは、 invitation.txtを定義することです:
{% block message %}Dear {{ first_name|title }} {{ last_name|upper }},
Your inscription has bee accepted. Welcome!
{% endblock %}
(body.txt、invitation.txt) と (body.html、invitation.txt) を読み込んで、2 つの html パーツを取得できるようにしたいと考えています。
編集:
そんな感じ:
招待状/body.txt :
{% extends body.txt invitation.txt %}
招待状/body.html :
{% extends body.html invitation.txt %}