1.8.6. email タグ (up)

email タグにより送信メールのヘッダーをカスタマイズすることができます。なお、このタグはメールテンプレート内でのみ利用可能です。

ccsubject などの便利なサブタグがいくつかあり (下表を参照)、操作を簡素化することができますが、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 %}

例: 条件付きブラインドカーボンコピー

{% email %}
  {% if plan.system_name == 'enterprise' %}
     {% bcc 'marketing@world-domination.org' %}
  {% endif%}
{% endemail %}

例: メールを一切無効にする

{% email %}
  {% do_not_send %}
{% endemail %}

例: サインアップメールのフィルター

{% email %}
  {% if plan.system == 'enterprise' %}
    {% subject = 'Greetings from Example company!' %}
    {% reply-to = 'support@example.com' %}
  {% else %}
    {% do_not_send %}
  {% endif %}
{% endemail %}