LoginSignup
0
1

More than 1 year has passed since last update.

SendGridのDynamicTemplateでtext/plainなメールを送信する方法

Posted at

知ってる人には当たり前かもしれないのですが、DynamicTemplateばかり使ってるとこの方法が全然わからず、記事も全然出てこなかったので備忘です。

var message = new SendGridMessage
{
    TemplateId = templateId,
    Personalizations = personalizations,
    Contents = new List<Content>
    {
        new Content
        {
            Type = "text/plain",
            Value = "<% body %>"
        }
    }
}

SendGridMessageのContentsにtext/plainのみを指定したContentを入れれば送信できました。
<% body %>はDynamicTemplateの中身で展開されるらしい。

templateIdやpersonalizationsについては公式ドキュメント見れば書いてあるのでこちらは大丈夫なはず。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1