1.8.6. Tag 'email' (up)
电子邮件 标签允许您自定义传出电子邮件的标头,且仅在电子邮件模板中可用。
有几个方便的子标签,如 cc 或 subject (请参见下表),但您也可以使用 header 子标签为邮件设置任意 SMTP 标头。
| 子标签 | 描述 | 示例 |
| subject | 动态主题 | {% subject = 'Greetings from Example company!' %} |
| cc | 抄送 | {% cc = 'boss@example.com' %} |
| bcc | 秘密抄送 | {% bcc = 'all@example.com' %} |
| from | 实际发送者 | {% from = 'system@example.com' %} |
| reply-to | {% reply-to = 'support@example.com' %} | |
| header | 自定义 SMTP 标头 | {% header 'X-SMTP-Group' = 'Important' %} |
| do_not_send | 丢弃电子邮件 | {% do_not_send %} |
Example:有条件的秘密抄送
{% email %}
{% if plan.system_name == 'enterprise' %}
{% bcc 'marketing@world-domination.org' %}
{% endif%}
{% endemail %}
{% email %}
{% if plan.system_name == 'enterprise' %}
{% bcc 'marketing@world-domination.org' %}
{% endif%}
{% endemail %}
Example:完全禁用电子邮件
{% email %}
{% do_not_send %}
{% endemail %}
{% email %}
{% do_not_send %}
{% endemail %}
Example:注册电子邮件过滤器