コード例 #1
0
ファイル: Mailer.php プロジェクト: HydrefLab/laravel-mailer
 /**
  * In SendGrid sections are used only with connection to substitutions.
  * Here, we're adding 'fake' substitutions that use defined sections.
  *
  * @param \SendGrid\Email $email
  * @return void
  */
 protected function setSections(\SendGrid\Email $email)
 {
     if (false === empty($this->globalVariables)) {
         foreach ($this->globalVariables as $name => $value) {
             /** @var Variable $globalVariable */
             $sectionName = $name . '_SECTION';
             $substitution = array_fill(0, count($this->recipients), $sectionName);
             $email->addSection($sectionName, $value);
             $email->addSubstitution($name, $substitution);
         }
     }
 }