Upgrade to Pro — share decks privately, control downloads, hide ads and more …

SendGrid Template Engine 奮闘記

SendGrid Template Engine 奮闘記

SendGrid Night #7 でのLT資料です
https://eventdots.jp/event/615303

Shogo Kawahara

March 28, 2017
Tweet

More Decks by Shogo Kawahara

Other Decks in Programming

Transcript

  1. 4FOE(SJE5FNQMBUF&OHJOF ͱ͸ BMXPSL Ԡืϝοηʔδͷར༻ͳͲ ٻ৬ऀ༷࠾༻୲౰ऀ༷ ϝʔϧૹ৴ "1*W #PVODF#MPDL৘ใͳͲ $VTUPNFS4VQQPSU 5FBN

    .BSLFUJOH&NBJM -FHBDZ  ʹΑΔϝϧϚΨͷൃߦӦۀ ֤छϝʔϧͷςϯϓϨʔτͷ؅ཧ .BOBHJOH5FNQMBUF&OHJOF ೥ͷߏ଄
  2. 4FOE(SJE5FNQMBUF&OHJOF ؆୯ͳ࢖͍ํ XJUI3VCZ4%, require 'sendgrid-ruby' personalization = SendGrid::Personalization.new personalization.to =

    SendGrid::Email.new(email: '[email protected]') personalization.substitutions = SendGrid::Substitution.new(key: '-username-', value: '઒ݪ') mail = SendGrid::Mail.new mail.from = SendGrid::Email.new(email: '[email protected]') mail.personalizations = personalization mail.template_id = '9c4878c0-0f94-4f8d-ae6b-2b86b499a1aa' sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY']) response = sg.client.mail._('send').post(request_body: mail.to_json)