2015-01-04 2 views
1

내 index.php에 SendGrid X-SMTPAPI 헤더를 작성하여 sendgrid 템플릿을 적용하려고합니다. 템플릿 엔진 템플릿을 사용하려면 템플릿 활성화템플릿 적용을위한 SendGrid SMTP API

"다음 SendGrid 문서에서 복사로,

  // Start Sendgrid 
      $sendgrid = new SendGrid('userid', 'pwd'); 
      $header = new Smtpapi\Header(); 
      $filter = array(
       'templates' => array(
       'settings' => array(
        'enabled' => 1, 
        'template_id' => 'f2c99ace-87af-2618-8390-c19e2ad2805f' 
       ) 
      ) 
      ); 
      $header->setFilters($filter); 
      $emailwelcome = new SendGrid\Email(); 
      $emailwelcome->addTo($email)-> 
        setFrom('[email protected]')-> 
        setFromName('Welcome to World')-> 
        setSubject('Your Invitation')-> 
        setText('Hello World!')-> 
        setHtml('<strong>Hello World!</strong>'); 
      $sendgrid->send($emailwelcome); 

템플릿을 적용하려면 :

내 index.php를 코드의 추상입니다 전송할 때 템플릿 필터를 활성화하고 template_id를 템플릿 엔진 템플릿 중 하나로 설정하십시오.

{ 
    "filters": { 
    "templates": { 
     "settings": { 
     "enable": 1, 
     "template_id": "5997fcf6-2b9f-484d-acd5-7e9a99f0dc1f" 
     } 
    } 
    } 
} 

이 JSON은 SMTP 메시지의 X-SMTPAPI 헤더 나 mail.send API 호출의 x-smtpapi 매개 변수에서 사용할 수 있습니다.

질문 : 내 SMTP 메시지의 X-SMTPAPI 헤더는 어디에 있습니까? 내 composer.json 또는 index.php 또는 공급 업체 파일에 있습니까?

도움 주셔서 감사합니다.

+0

: 당신이 할 필요가 index.php에 코드의 이러한 두 줄을 추가입니다 .com 또는 customer.io. 유스 케이스에 따라 체크 아웃 할 가치가 있습니다. – bvanvugt

답변

2

그래, 그렇게 분명히. 이 같은 sendwithus 같은 SendGrid 위에 작동하는 주형 서비스는, 거기에 전혀 도움이된다면

addFilter('templates', 'enable', 1)-> 
addFilter('templates', 'template_id', 'f2c99ace-87af-3618-8390-c19e2ad2805f'); 

Weeeeeeeee ~

관련 문제